From c63bbbd5cd5859fe91741e8d6785f9c64bdf203b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=CC=81=20Padilla?= Date: Sun, 14 Apr 2013 20:35:52 -0400 Subject: [PATCH] Fix: webhook view post method Gets the JSON data from the mandrill_events param. Also returns a 400 error if there's any issues loading the webhook request. --- djrill/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/djrill/views.py b/djrill/views.py index 722594b..8a420cf 100644 --- a/djrill/views.py +++ b/djrill/views.py @@ -166,7 +166,10 @@ class DjrillWebhookView(DjrillWebhookSecretMixin, View): return HttpResponse() def post(self, request, *args, **kwargs): - data = json.loads(request.body) + try: + data = json.loads(request.POST.get('mandrill_events')) + except TypeError: + return HttpResponse(status=400) for event in data: signals.webhook_event.send(