diff --git a/lib/utils.py b/lib/utils.py index f204351..7bfb29f 100644 --- a/lib/utils.py +++ b/lib/utils.py @@ -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 diff --git a/static/cosmopolite.js b/static/cosmopolite.js index 0bd8dbf..2749b57 100644 --- a/static/cosmopolite.js +++ b/static/cosmopolite.js @@ -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)); };