use json_loads function in json property of request

This commit is contained in:
Hugh McNamara 2017-09-22 10:19:15 +01:00
parent a8f764c161
commit 5cef1634ed

View File

@ -71,12 +71,7 @@ class Request(dict):
@property
def json(self):
if self.parsed_json is None:
try:
self.parsed_json = json_loads(self.body)
except Exception:
if not self.body:
return None
raise InvalidUsage("Failed when parsing body as json")
self.load_json()
return self.parsed_json