mirror of
https://github.com/usebruno/bruno.git
synced 2025-02-02 02:49:48 +01:00
* fix: handle case of text when invalid JSON (#3119) * don't stringify if json is invalid, and maintain indentation if stringified * stringify check --------- Co-authored-by: lohit <lohxt.space@gmail.com>
This commit is contained in:
parent
8b6e55dfc0
commit
938e0560a2
@ -19,6 +19,10 @@ const formatResponse = (data, mode, filter) => {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (data === null) {
|
||||
return data;
|
||||
}
|
||||
|
||||
if (mode.includes('json')) {
|
||||
let isValidJSON = false;
|
||||
|
||||
@ -28,7 +32,7 @@ const formatResponse = (data, mode, filter) => {
|
||||
console.log('Error parsing JSON: ', error.message);
|
||||
}
|
||||
|
||||
if (!isValidJSON || data === null) {
|
||||
if (!isValidJSON && typeof data === 'string') {
|
||||
return data;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user