use json_loads function in json property of request
This commit is contained in:
parent
a8f764c161
commit
5cef1634ed
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user