Throw sensible errors on not-json when allowing empty body

This commit is contained in:
David Baker 2015-04-02 17:45:16 +01:00
parent 41cd778d66
commit 6b59650753

View File

@ -44,7 +44,10 @@ def parse_request_allow_empty(request):
content = request.content.read()
if content is None or content == '':
return None
try:
return simplejson.loads(content)
except simplejson.JSONDecodeError:
raise SynapseError(400, "Content not JSON.")
def parse_json_dict_from_request(request):