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 (#10223)
Backports PR #10201
**Commit 1:**
[console] Set multiline json content type to application/x-ndjson
* Original sha: 8a703d868e
* Authored by Jonathan Budzenski <jon@jbudz.me> on 2017-02-06T18:22:03Z
This commit is contained in:
parent
4d1e3129fb
commit
94a4a8a2d0
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