mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[console] Set multiline json content type to application/x-ndjson
This commit is contained in:
parent
912454a31f
commit
8a703d868e
1 changed files with 11 additions and 2 deletions
|
@ -23,8 +23,17 @@ module.exports.send = function (method, path, data, server, disable_auth_alert)
|
|||
try {
|
||||
JSON.parse(data);
|
||||
contentType = 'application/json';
|
||||
} catch (e) {
|
||||
contentType = 'text/plain';
|
||||
}
|
||||
catch (e) {
|
||||
try {
|
||||
data.split('\n').forEach(line => {
|
||||
if (!line) return;
|
||||
JSON.parse(line);
|
||||
});
|
||||
contentType = 'application/x-ndjson';
|
||||
} catch (e){
|
||||
contentType = 'text/plain';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue