insomnia icon indicating copy to clipboard operation
insomnia copied to clipboard

[Enhancement] Friendlier JSON in Preview mode

Open jvukovich opened this issue 5 years ago • 28 comments

It looks like Insomnia always escapes the forward slash: \/

Can this be an option in the response window, or the IDE as global option?

This bit us, as a very long encoded value was behaving one way in Insomnia (escaping the forward slash), but was different in another REST client (Postman: it doesn't escape forward slashes).

Thanks!

jvukovich avatar Jun 12 '19 02:06 jvukovich

👋 Thanks for opening your first issue! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. If you're requesting a feature 🎁, please provide real use cases that would benefit. 👪

To help make this a smooth process, please be sure you have first read the contributing guidelines.

welcome[bot] avatar Jun 12 '19 02:06 welcome[bot]

Where are you seeing the forward slash being escaped?

gschier avatar Jun 13 '19 15:06 gschier

In the response, in the content of a string property: i.e. {"prop": "a\/string\/field"} when we're expecting it to be {"prop": "a/string/field"} -- thanks!

jvukovich avatar Jun 15 '19 18:06 jvukovich

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 15 '19 06:08 stale[bot]

Just trying Insomnia for the first time. Gorgeous -- nice work! We're having this issue as well. We return links in our payload in relative form (no scheme or authority). All forward slashes are rendered as escaped making them not clickable.

trevtrich avatar Sep 18 '19 14:09 trevtrich

The same issue for me. Option for disabling of escaping all forward slashes would be very nice.

vavra7 avatar Nov 27 '19 17:11 vavra7

I think having the Preview show more friendly JSON could be a good idea

gschier avatar Dec 11 '19 20:12 gschier

Any progress on this?

pedzed avatar May 13 '20 16:05 pedzed

Hello everyone, will this be fixed?

I am still getting escape URL/links.

Will it be possible to not show these escaped?

K2ouMais avatar May 26 '20 09:05 K2ouMais

Almost a year and no progress on this ?

K2ouMais avatar Mar 24 '21 19:03 K2ouMais

Adding label for investigation / verification after attempting to replicate and being unable to do so.

Can someone who is encountering this document the steps to replicate along with the request / response body and headers used to replicate - preferably with screenshots.

It seems like an edge-case or misconfigured settings / content-types, see screenshot below where my slashes are not escaped:

Screen Shot 2021-03-24 at 12 45 18 PM

Pasting from the preview pane also does not result in slashes:

"prop": "hello/world/there"

nijikokun avatar Mar 24 '21 19:03 nijikokun

There is no misconfiguration at all. I even have installed Insomnia on a brand new PC and without have setting anything URLs are all escaped. Do a request to an API that is reponding an URL and you will see it escaped. Simple as that. The content-type I was using was a simple application/json and probably the most common out there.

K2ouMais avatar Mar 24 '21 21:03 K2ouMais

@K2ouMais I hear you but without proper steps to replicate and exact information it makes it difficult to work on. What version of Insomnia are you running and what is the url, request body, and headers you are requesting with, as I cannot replicate the issue.

nijikokun avatar Mar 24 '21 21:03 nijikokun

Ok, it is really late here. I will try to give you a proper example tomorrow.

K2ouMais avatar Mar 24 '21 21:03 K2ouMais

maybe http://mockbin.org/ will be useful in simulating such a response

dimitropoulos avatar Mar 24 '21 23:03 dimitropoulos

Here is a good example: GET https://api.gleif.org/api/v1/entity-legal-forms

Escaped URLs: EscapedLinks

Headers: Headers

Preferences using the newest Insomnia version: Preferences

This API has probably a Laravel Backend.

I am seeing the same behaviour on my API with a Laravel Backend.

I dont know if this could be the problem.

If I use the exact same example in Postman, every link seems to be right.

K2ouMais avatar Mar 25 '21 07:03 K2ouMais

@dimitropoulos @nijikokun I have inserted a proper API where the URLs are escaped. Could you please take a look at it?

Thank you

K2ouMais avatar Mar 26 '21 07:03 K2ouMais

Having the same issue :( still no fix?

fcoriverah avatar Apr 29 '21 16:04 fcoriverah

Nope. They wanted me to show them the problem and since then nothing.

It has been a month.

K2ouMais avatar Apr 29 '21 16:04 K2ouMais

Nope. They wanted me to show them the problem and since then nothing.

It has been a month.

Sad, i really like Insomnia over Postman but this...

fcoriverah avatar Apr 29 '21 16:04 fcoriverah

I've the same issue. Postman works fine for same API. Insomnia please fix it.

rmsohaila avatar Jun 03 '21 17:06 rmsohaila

Same here, spent several hours to undestand why the token I request is not valid with Insomnia but it is with Postman. It was just because forward slash is escaped :

sc1

sgostanyan avatar Jun 04 '21 13:06 sgostanyan

@sgostanyan very sorry to hear that you lost time due to this. I've asked internally if we can get this prioritized in some way.

@K2ouMais sorry on the dealyed response. A bot to mark issues got enabled which flooded my inbox with 600+ issues from insomnia and your response here got lost in the shuffle.

I think I understand what's going on.

So first off, the response you gave includes the escapes

Here's an example with just curl Screenshot_20210604_100139

Here's an example from chrome: Screenshot_20210604_100222

And, indeed, here's an example from Postman: Screenshot_20210604_100255

The difference here is that in our "Preview" mode, which is sorta like a pretty print, we use the JSON.stringify behavior.

For example, Screenshot_20210604_101209

For this behavior to change, we'd need to update something around here: https://github.com/Kong/insomnia/blob/develop/packages/insomnia-app/app/ui/components/codemirror/code-editor.tsx#L634

I made a mockbin we can use for this: http://mockbin.org/bin/6f5df8ac-8fa4-4aa0-8961-d01ed9f29d7a

Screenshot_20210604_105732

dimitropoulos avatar Jun 04 '21 14:06 dimitropoulos

Any progress on this? I could take a stab at a PR, but, not being at all familiar with the codebase, I'd probably do it wrong.

jvukovich avatar Mar 22 '22 23:03 jvukovich

Still no progress ?

Harrylepap avatar Jun 15 '22 07:06 Harrylepap

Is there any chance this issue can be prioritised? I'm really not sure why forward slashes in network responses are being escaped in the Preview tab.

massimocode avatar Dec 13 '22 12:12 massimocode

i think someone has addressed this kind issue long ago and it has been closed 🤔 pls check this @jvukovich link-issue

rusagaib avatar Mar 20 '24 14:03 rusagaib

Thanks, I wasn't aware of the other closed issue.

Well, there looks like there are quite a few recent follow-ups on that closed issue, too, particularly mrjimhubbard's suggestion: image

Should we not leave this issue open if enough people are rallying around making this clearer/easier/user-friendly?

jvukovich avatar Mar 20 '24 20:03 jvukovich