Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

DawoodMorris
Copy link

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):

image

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):

image

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

return safeStringifyJSON(parsed, true);
}

if (typeof data === 'string') {
return data;
}

return safeStringifyJSON(data);
//return safeStringifyJSON(data)

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.

Suggested change
//return safeStringifyJSON(data)
//return safeStringifyJSON(data)

try {
isTrueJSON = typeof JSON.parse(JSON.stringify(data)) === 'object';
} catch (error) {
console.log('Error parsing JSON: ', error.message);

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?

Suggested change
console.log('Error parsing JSON: ', error.message);
console.log('Error parsing JSON: ', error.message);

Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants