The API Iām using returns the wrong Content-Type, so itād be nice to be able to use the post-request ātestā scripts to set the response viewer pane to the right settings.
Currently I have to manually choose āprettyā and āJSONā each time, itās fairly annoying.
Unfortunately, not going to happen. Itās a deprecated API and will not have its return type changed from ātext/plainā but I need to work with it a little longer for various reasons. No more development of any kind on that API will be merged.
Believe it or not, the wrong Content-Type was actually intentional: it stops IE8 from showing a download dialogue for āapplication/jsonā
Now we no longer support IE8ā¦ but the broken Content-Type remains.
I canāt see this being a needed feature within Postman, seems like itās just papering over a problem (albeit something that will never be fixed ) rather than solving one.
If the text response is in a JSON āformatā you could do a JSON.stringify(pm.response.text(), null, 2) and log it to the console.
I feel that being able to control some UI elements programmatically could be kind of useful though. This API canāt be the only one misreporting its Content-Type. But I donāt have really, really strong feelings about it.
Perhaps you could like set āprettyā and āJSONā for a saved request and just have it always try to use that setting no matter the content-type, rather than having to reset after each call. Or even if it could be a bit more intelligent about āthis looks like itās JSONā.
Hmm. We donāt have a scriptable way to change this but you can force the viewer to try to render JSON by going to the Settings screen and change Language Detection from Auto to JSON