Switched to try/except
This commit is contained in:
parent
53b61d13f9
commit
5f140048f4
|
@ -10,7 +10,9 @@ except ImportError:
|
||||||
from json import loads as _json_loads
|
from json import loads as _json_loads
|
||||||
|
|
||||||
def json_loads(i):
|
def json_loads(i):
|
||||||
i = i.decode() if isinstance(i, bytes) else i
|
try:
|
||||||
|
return _json_loads(i.decode())
|
||||||
|
except AttributeError:
|
||||||
return _json_loads(i)
|
return _json_loads(i)
|
||||||
|
|
||||||
from sanic.exceptions import InvalidUsage
|
from sanic.exceptions import InvalidUsage
|
||||||
|
|
Loading…
Reference in New Issue
Block a user