-
-
Notifications
You must be signed in to change notification settings - Fork 962
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: display raw query response unformatted for readability #2272
base: main
Are you sure you want to change the base?
feat: display raw query response unformatted for readability #2272
Conversation
return safeStringifyJSON(parsed, true); | ||
} | ||
|
||
if (typeof data === 'string') { | ||
return data; | ||
} | ||
|
||
return safeStringifyJSON(data); | ||
//return safeStringifyJSON(data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest to remove commented code.
//return safeStringifyJSON(data) | |
//return safeStringifyJSON(data) |
try { | ||
isTrueJSON = typeof JSON.parse(JSON.stringify(data)) === 'object'; | ||
} catch (error) { | ||
console.log('Error parsing JSON: ', error.message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Console output is not required here, I think?
console.log('Error parsing JSON: ', error.message); | |
console.log('Error parsing JSON: ', error.message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, that (the console.log) is not required. It was for inspection purposes. We can remove it.
Description
In the current Bruno release, when the query response is raw text, such as when the server returns an error and outputs programming language error messages, the response looks like the following image and, is not clearly readable (in my humble opinion):
The solution is to display the raw response unformatted if it is raw text or mixed with unformattable data as in the above screenshot.
After modifying the
formatResponse
function in the/bruno/packages/bruno-app/src/components/ResponsePane/QueryResult
component, to not format if the data is raw and not parsable, the display looks like the following and is readable (in my humble opinion):Good To Consider
I have been using Postman for a long time. Then I recently updated it and it became very slow and sucked the burn out of me as it slowed my machine. I grew impatient as it was getting in my way. I began hunting for alternatives and came across Bruno. The only setback with Bruno was that I could not read the raw server responses during my work (you know the usual programming errors dance!). I tried to come up with a solution because in Postman when the response is raw text and not parsable, it is displayed clearly and is legible.
My proposed feature/solution achieves the same effect in Bruno.
I hope this makes sense.
Thanks
Dawood