recovery json error

This commit is contained in:
lizheao 2017-08-30 12:06:36 +08:00
parent ad1d3d93f6
commit fdc877c66d

View File

@ -2,7 +2,7 @@ from mimetypes import guess_type
from os import path from os import path
try: try:
from ujson import dumps as ujson_dumps from ujson import dumps as json_dumps
except: except:
from json import dumps as jjson_dumps from json import dumps as jjson_dumps
finally: finally:
@ -246,7 +246,7 @@ def json(body, status=200, headers=None,
:param kwargs: Remaining arguments that are passed to the json encoder. :param kwargs: Remaining arguments that are passed to the json encoder.
""" """
try: try:
return HTTPResponse(ujson_dumps(body, **kwargs), headers=headers, return HTTPResponse(json_dumps(body, **kwargs), headers=headers,
status=status, content_type=content_type) status=status, content_type=content_type)
except Exception as e: except Exception as e:
return HTTPResponse(jjson_dumps(body, **kwargs), headers=headers, return HTTPResponse(jjson_dumps(body, **kwargs), headers=headers,