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
|
@property
|
||||||
def json(self):
|
def json(self):
|
||||||
if self.parsed_json is None:
|
if self.parsed_json is None:
|
||||||
try:
|
self.load_json()
|
||||||
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
|
return self.parsed_json
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user