Set request and response content type to json.
This commit is contained in:
@@ -40,6 +40,7 @@ def returns_json(handler):
|
|||||||
|
|
||||||
@functools.wraps(handler)
|
@functools.wraps(handler)
|
||||||
def SerializeResult(self):
|
def SerializeResult(self):
|
||||||
|
self.response.headers['Content-Type'] = 'application/json'
|
||||||
json.dump(handler(self), self.response.out, default=EncodeJSON)
|
json.dump(handler(self), self.response.out, default=EncodeJSON)
|
||||||
|
|
||||||
return SerializeResult
|
return SerializeResult
|
||||||
|
|||||||
@@ -950,6 +950,7 @@ Cosmopolite.prototype.sendRPCs_ = function(commands, opt_delay) {
|
|||||||
'load', this.onRPCResponse_.bind(this, xhr, retryAfterDelay, commands));
|
'load', this.onRPCResponse_.bind(this, xhr, retryAfterDelay, commands));
|
||||||
xhr.addEventListener('error', retryAfterDelay.bind(null, commands));
|
xhr.addEventListener('error', retryAfterDelay.bind(null, commands));
|
||||||
xhr.open('POST', this.urlPrefix_ + '/api');
|
xhr.open('POST', this.urlPrefix_ + '/api');
|
||||||
|
xhr.setRequestHeader('Content-Type', 'application/json');
|
||||||
xhr.responseType = 'json';
|
xhr.responseType = 'json';
|
||||||
xhr.send(JSON.stringify(request));
|
xhr.send(JSON.stringify(request));
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user