Handle any malformed JSON input instead of just an empty body

(imported from commit a8a99173697ab6fb1ec60cf499e40cde8b8549d5)
This commit is contained in:
Leo Franchi 2013-05-15 18:03:16 -04:00 committed by Tim Abbott
parent 9ffbc6d4ab
commit 1902f6f149
1 changed files with 4 additions and 4 deletions

View File

@ -1578,10 +1578,10 @@ def api_jira_webhook(request):
except (AttributeError, KeyError):
return json_error("Missing api_key parameter.")
if request.body == '':
return json_error("No XML POST data!")
payload = simplejson.loads(request.body)
try:
payload = simplejson.loads(request.body)
except simplejson.JSONDecodeError:
return json_error("Malformed JSON input")
try:
stream = request.GET['stream']