Set request and response content type to json.

This commit is contained in:
Ian Gulliver
2015-05-31 21:23:45 -07:00
parent 3fa24f803d
commit 1e6da9504a
2 changed files with 2 additions and 0 deletions

View File

@@ -40,6 +40,7 @@ def returns_json(handler):
@functools.wraps(handler)
def SerializeResult(self):
self.response.headers['Content-Type'] = 'application/json'
json.dump(handler(self), self.response.out, default=EncodeJSON)
return SerializeResult

View File

@@ -950,6 +950,7 @@ Cosmopolite.prototype.sendRPCs_ = function(commands, opt_delay) {
'load', this.onRPCResponse_.bind(this, xhr, retryAfterDelay, commands));
xhr.addEventListener('error', retryAfterDelay.bind(null, commands));
xhr.open('POST', this.urlPrefix_ + '/api');
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.responseType = 'json';
xhr.send(JSON.stringify(request));
};