thunder-client-support
thunder-client-support copied to clipboard
Add format button to response
Is your feature request related to a problem? Please describe. No
Describe the solution you'd like Let's add the ability to format the response
Describe alternatives you've considered Formatting the response outside of thunderclient
Implementation: No. But, if the source is shared, I am happy to take a swing at a PR!
Hi @TroyWitthoeft, thanks for creating the issue.
Can you share a screenshot of the use-case and also where you want format button?
Yes, I can.

Can we add a format button to the response pane? I'm envisioning just adding an additional format button on the response pane (above, red line). Something that would let us prettify?
In the example above, we are sending and receiving some complex xml. The response does not contain linebreaks or indentations. It's on a single line and thunder-client struggles with formatting it. However, we're currently using a very popular api suite that CAN pretty-print / format these types of response xml.
Adding this capability would help us adopt thunder-client over our existing standalone api app.
Thanks for sharing screenshots. It should format the xml automatically. which could be a bug
What is response content type?, it should be in headers tab? just to clarify the content type.
The response type coming out of that server is text/html; charset=utf-8
So, it's clear why it's not being automatically formatted. However an optional format button could help in these types of situations! 😄 Any chance we can add one?
Thanks for clarifying. If you can update the content-type this should be fixed.
If we provide Format button also, it would be based on content type right?
the format functionality should know what type of content - to format correctly.
If we provide Format button also, it would be based on content type right?
I mean, that is a convenient way to do it, yes. But, it also creates a dependency on the remote client setting the content-type accurately. That may not always be the case.
What about a format button that was a dropdown between, xml, json, and text and would just let the user apply prettification after the response arrived? It's not automatic, but it IS flexible, and it would handle these types of situations.
Again, other "bigbox" api clients are not relying on the content-type of the remote server.
Maybe we should take a look and see if insomnia /hopscotch rely on that content-type setting? Perhaps it's only a thick client like postman that doesn't? What format detection methods are being used there?
Thanks for the suggestion, Will add to roadmap for manual format button.
Thanks, and happy to recon other clients for you to see if they have lightweight way of intelligently deciding what type of formatting should be applied in situations where the response body and content-type disagree.
I have tested on insomnia, with wrong content-type, it does not format.

you can use this url to test yourself https://www.thunderclient.com/t/echo
Add request header content-type - text/html
and this in xml body
<test><name>abc</name><loc>test</loc></test>
Thanks my working example is postman. It does detect and format for me. Haven't checked others.
actually there is alternative option in thunder client, you can open the response in vscode and let vscode format it for you..
This is very much similar to having a manual format button. let me know what you think?
That's a decent workaround! But, it is an extra hop and click for users.
I guess I'm trying to get thunder up to feature parity with peers.
I recently had a dev say they wouldn't adopt it because postman formats and thunder doesn't.
Will point this one out to them.

Thanks for feedback. Will add to roadmap.
Found some detail on hoppscotch approach here https://github.com/hoppscotch/hoppscotch/blob/c1cc1ce2955d6b82a82a53cdae54830220431084/packages/hoppscotch-app/helpers/curl/sub_helpers/contentParser.ts
Thanks @TroyWitthoeft for sharing the info, will look into it.
strange hoppscotch does not do auto format based on content.
This feature is now implemented and published to marketplace, please update to v1.18.3
See all features released https://github.com/rangav/thunder-client-support/releases/tag/v1.18.3
Please let me know your feedback.
Just retested with latest version of thunder-client and all looks good! Returned xml is automatically formatted even if the remote server is not correctly setting the content-type header.
Thank you, and impressively quick work! 🤯
Let's mark this as resolved, and let me know how I can be of service in the future!
Thanks @TroyWitthoeft for confirmation :)
Any feedback to further improve the product is appreciated very much.