Update fix for API response header for JSON content type and the return of JSONP data to updated package (ref:hacks.txt).

This commit is contained in:
JackDandy 2015-05-18 19:20:58 +01:00
parent 9d4f5cbf91
commit 5843623136
2 changed files with 5 additions and 1 deletions

View file

@ -23,6 +23,7 @@
* Update SimpleJSON library 3.7.3 to 3.8.0 (a37a9bd)
* Update Tornado Web Server 4.2 to 4.3.dev1 (1b6157d)
* 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.10.0 (2015-08-06 11:05:00 UTC)

View file

@ -692,7 +692,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)