mirror of
https://github.com/usebruno/bruno.git
synced 2025-02-19 11:11:40 +01:00
fix: condition
This commit is contained in:
parent
54d8fbc478
commit
b6b4b7362f
@ -365,14 +365,17 @@ const parseDataFromResponse = (response, disableParsingResponseJson = false) =>
|
|||||||
try {
|
try {
|
||||||
// Filter out ZWNBSP character
|
// Filter out ZWNBSP character
|
||||||
// https://gist.github.com/antic183/619f42b559b78028d1fe9e7ae8a1352d
|
// https://gist.github.com/antic183/619f42b559b78028d1fe9e7ae8a1352d
|
||||||
|
|
||||||
|
// a quoated string is also a vaild json but we want to show it as a quoated string only (parsing removes the quoates)
|
||||||
data = data.replace(/^\uFEFF/, '');
|
data = data.replace(/^\uFEFF/, '');
|
||||||
if (
|
if ( !disableParsingResponseJson && ! (typeof data === 'string' && data.startsWith("\"") && data.endsWith("\""))) {
|
||||||
!disableParsingResponseJson
|
data = JSON.parse(data);
|
||||||
&& !(data.startsWith("\"") && data.endsWith("\"")) // a quoated string is also a vaild json but we want to show it as a quoated string only (parsing removes the quoates)
|
} {
|
||||||
) {
|
|
||||||
data = JSON.parse(data);
|
data = JSON.parse(data);
|
||||||
}
|
}
|
||||||
} catch { }
|
} catch {
|
||||||
|
console.log('Failed to parse response data as JSON');
|
||||||
|
}
|
||||||
|
|
||||||
return { data, dataBuffer };
|
return { data, dataBuffer };
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user