Skip to content

Commit

Permalink
Merge pull request elastic#7966 from ycombinator/console/fix-content-…
Browse files Browse the repository at this point in the history
…type-header

Set content-type header to application/json

Former-commit-id: af3558c
  • Loading branch information
ycombinator authored Aug 9, 2016
2 parents d7ba30f + 98eec23 commit c73c9d8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/core_plugins/console/public/src/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,20 @@ module.exports.send = function (method, path, data, server, disable_auth_alert)
// delayed loading for circular references
var settings = require("./settings");

let contentType;
if (data) {
try {
JSON.parse(data);
contentType = 'application/json';
} catch (e) {
contentType = 'text/plain';
}
}

var options = {
url: '../api/console/proxy?uri=' + encodeURIComponent(path),
data: method == "GET" ? null : data,
contentType,
cache: false,
crossDomain: true,
type: method,
Expand Down

0 comments on commit c73c9d8

Please sign in to comment.