From fdc877c66dfc795bf67d828aa6b35fd76eb70920 Mon Sep 17 00:00:00 2001 From: lizheao Date: Wed, 30 Aug 2017 12:06:36 +0800 Subject: [PATCH] recovery json error --- sanic/response.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sanic/response.py b/sanic/response.py index 90925712..25c7bacb 100644 --- a/sanic/response.py +++ b/sanic/response.py @@ -2,7 +2,7 @@ from mimetypes import guess_type from os import path try: - from ujson import dumps as ujson_dumps + from ujson import dumps as json_dumps except: from json import dumps as jjson_dumps finally: @@ -246,7 +246,7 @@ def json(body, status=200, headers=None, :param kwargs: Remaining arguments that are passed to the json encoder. """ try: - return HTTPResponse(ujson_dumps(body, **kwargs), headers=headers, + return HTTPResponse(json_dumps(body, **kwargs), headers=headers, status=status, content_type=content_type) except Exception as e: return HTTPResponse(jjson_dumps(body, **kwargs), headers=headers,