Browse Source

/bounce handles long payloads.

pull/117/head
Pēteris Caune 8 years ago
parent
commit
d5cb669172
2 changed files with 7 additions and 1 deletions
  1. +6
    -0
      hc/api/tests/test_bounce.py
  2. +1
    -1
      hc/api/views.py

+ 6
- 0
hc/api/tests/test_bounce.py View File

@ -34,3 +34,9 @@ class BounceTestCase(BaseTestCase):
url = "/api/v1/notifications/%s/bounce" % self.n.code url = "/api/v1/notifications/%s/bounce" % self.n.code
r = self.client.post(url, "foo", content_type="text/plain") r = self.client.post(url, "foo", content_type="text/plain")
self.assertEqual(r.status_code, 400) 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)

+ 1
- 1
hc/api/views.py View File

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

Loading…
Cancel
Save