From f47e571d927b252e9f9383dbad3c33746321dd5a Mon Sep 17 00:00:00 2001 From: Tue Topholm Date: Thu, 1 Jun 2017 22:53:56 +0200 Subject: [PATCH] Added content_type to be set for son response --- sanic/response.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sanic/response.py b/sanic/response.py index 9a304bb7..645bcaa2 100644 --- a/sanic/response.py +++ b/sanic/response.py @@ -233,7 +233,7 @@ class HTTPResponse(BaseHTTPResponse): return self._cookies -def json(body, status=200, headers=None, **kwargs): +def json(body, status=200, headers=None, content_type="application/json", **kwargs): """ Returns response object with body in json format. :param body: Response data to be serialized. @@ -242,7 +242,7 @@ def json(body, status=200, headers=None, **kwargs): :param kwargs: Remaining arguments that are passed to the json encoder. """ return HTTPResponse(json_dumps(body, **kwargs), headers=headers, - status=status, content_type="application/json") + status=status, content_type=content_type) def text(body, status=200, headers=None,