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.
This commit is contained in:
José Padilla
2013-04-14 20:35:52 -04:00
parent e2b36b1dde
commit c63bbbd5cd

View File

@@ -166,7 +166,10 @@ class DjrillWebhookView(DjrillWebhookSecretMixin, View):
return HttpResponse() return HttpResponse()
def post(self, request, *args, **kwargs): 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: for event in data:
signals.webhook_event.send( signals.webhook_event.send(