Merge pull request #517 from r0fls/empty-json

return valid json in request.json
This commit is contained in:
Raphael Deem
2017-03-10 00:35:26 -08:00
committed by GitHub
2 changed files with 15 additions and 5 deletions

View File

@@ -69,6 +69,8 @@ class Request(dict):
try:
self.parsed_json = json_loads(self.body)
except Exception:
if not self.body:
return None
raise InvalidUsage("Failed when parsing body as json")
return self.parsed_json