diff --git a/CHANGES.md b/CHANGES.md index a7158cd3..03c03786 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,7 @@ * Remove EZRSS provider * Update Tornado webserver to 4.2b1 (61a16c9) * Update change to suppress reporting of Tornado exception error 1 to updated package (ref:hacks.txt) +* Update fix for API response header for JSON content type and the return of JSONP data to updated package (ref:hacks.txt) ### 0.9.0 (2015-05-18 14:33:00 UTC) diff --git a/tornado/web.py b/tornado/web.py index 0a50f793..aa5d02e1 100644 --- a/tornado/web.py +++ b/tornado/web.py @@ -694,7 +694,10 @@ class RequestHandler(object): message += ". Lists not accepted for security reasons; see http://www.tornadoweb.org/en/stable/web.html#tornado.web.RequestHandler.write" raise TypeError(message) if isinstance(chunk, dict): - chunk = escape.json_encode(chunk) + if 'unwrap_json' in chunk: + chunk = chunk['unwrap_json'] + else: + chunk = escape.json_encode(chunk) self.set_header("Content-Type", "application/json; charset=UTF-8") chunk = utf8(chunk) self._write_buffer.append(chunk)