Skip to content
Snippets Groups Projects
Commit 9329cd5f authored by David Baker's avatar David Baker
Browse files

Merge pull request #608 from gergelypolonkai/syn-638

Add error codes for malformed/bad JSON in /login
parents faa3d172 87acd8fb
No related branches found
No related tags found
No related merge requests found
......@@ -404,10 +404,12 @@ def _parse_json(request):
try:
content = json.loads(request.content.read())
if type(content) != dict:
raise SynapseError(400, "Content must be a JSON object.")
raise SynapseError(
400, "Content must be a JSON object.", errcode=Codes.BAD_JSON
)
return content
except ValueError:
raise SynapseError(400, "Content not JSON.")
raise SynapseError(400, "Content not JSON.", errcode=Codes.NOT_JSON)
def register_servlets(hs, http_server):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment