diff --git a/hc/api/tests/test_bounce.py b/hc/api/tests/test_bounce.py index 8b4b4d1d..da858de2 100644 --- a/hc/api/tests/test_bounce.py +++ b/hc/api/tests/test_bounce.py @@ -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) diff --git a/hc/api/views.py b/hc/api/views.py index 36ce3a16..91607e93 100644 --- a/hc/api/views.py +++ b/hc/api/views.py @@ -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()