/bounce handles long payloads.

This commit is contained in:
Pēteris Caune 2017-03-05 22:32:42 +02:00
parent 68d591c677
commit d5cb669172
2 changed files with 7 additions and 1 deletions

View File

@ -34,3 +34,9 @@ class BounceTestCase(BaseTestCase):
url = "/api/v1/notifications/%s/bounce" % self.n.code
r = self.client.post(url, "foo", content_type="text/plain")
self.assertEqual(r.status_code, 400)
def test_it_handles_long_payload(self):
url = "/api/v1/notifications/%s/bounce" % self.n.code
payload = "A" * 500
r = self.client.post(url, payload, content_type="text/plain")
self.assertEqual(r.status_code, 200)

View File

@ -190,7 +190,7 @@ def bounce(request, code):
if td.total_seconds() > 600:
return HttpResponseBadRequest()
notification.error = request.body
notification.error = request.body[:200]
notification.save()
return HttpResponse()