Allow opening links in response in Insomnia #3660
Replies: 24 comments 1 reply
-
👋 Thanks for opening your first issue! If you're reporting a 🐞 bug, please make sure To help make this a smooth process, please be sure you have first read the |
Beta Was this translation helpful? Give feedback.
-
This seems like a great feature to have |
Beta Was this translation helpful? Give feedback.
-
How should the traversal look like? Should it automatically add requests to the list of requests on the left? Or should it happen within the current request context, i.e. by setting a new target URL - if we do that, a Back button would be extremely nice. |
Beta Was this translation helpful? Give feedback.
-
I have three potential ideas right now:
The plugin system isn't advanced enough to implement a feature like that yet. |
Beta Was this translation helpful? Give feedback.
-
I prefer the first variant, (if I understand it correctly):
Can the requests be added to the response history as well? I found _handleOpenLink in response-viewer.js, I suppose that is where the change has to start from. Would it be ok for you if I try to load the new link into response viewer and make a pull request? Is there anything I need to be aware of? |
Beta Was this translation helpful? Give feedback.
-
For option one it wouldn't be possible to add the response to the history dropdown, since technically it would be the same response. |
Beta Was this translation helpful? Give feedback.
-
If you want to play around with a proof of concept that would be alright. I don't think we've settled on a good enough solution yet though. |
Beta Was this translation helpful? Give feedback.
-
If you map this idea to how a browser works, the request definition on the left with the URL address, the body and Auth pane etc. would be an extremely powerful "bookmark editor", whereas the preview pane would be the actual browser window. |
Beta Was this translation helpful? Give feedback.
-
I have created a feature branch in my fork which can follow links in the response view, to experiment with the overall UX and to see if you agree with the concept: https://github.com/dschulten/insomnia/tree/feature/allow-opening-links-in-response The branch handles clicking on links and creates an in-memory history, with back and forward buttons. This is what it looks like (except for the green triangle in the red box, which I will explain below): First question: what do you think about the overall UX? Should I open a PR, after adding tests? Second question: Currently a click on a link is always a GET. That is not sufficient in many situations. What do you think about the following proposal: Example: As you can see, the API in the screenshot contains a Siren form which describes a POST with certain request data (a "hypermedia affordance"). When users click the play triangle alongside the POST action, a Siren plugin could build a request body from the The job of the plugin would be to deliver three things for the modal:
If you like the latter idea, I could build a separate PR for that. |
Beta Was this translation helpful? Give feedback.
-
Nice work on the code @dschulten! I like the direction it's going so far.
I think the UX is off to a good start. I fear it will cause confusion with the history menu on the far right but that's more of a UI/design issue than a UX issue. How do you feel about adding another horizontal bar (maybe light gray and not that tall) above the tabs to represent the "follow up" responses as breadcrumbs? It would cost a bit more in UI real estate but seems like it could be more clear to the user (just an idea). You mentioned you're storing the history in memory. I feel like the responses could probably be saved in the DB as children to the original response. This way they would persist across app launches and would probably lead to less bugs.
I think having a plugin API to control link actions may be a good idea for the future but is probably still too undefined to implement at this point. I would prefer to build the general first-party solution first, then go from there using user feedback to drive the roadmap. ✌ |
Beta Was this translation helpful? Give feedback.
-
The separate row would have a clear purpose: navigating responses. It could also be used to show clickable links from link headers later. Should the breadcrumbs replace the back/forward buttons, and what does a breadcrumb item show - maybe the last path segment of the URL, and the query if present, like the network tab in Chrome devtools? Often breadcrumbs represent where you are in the hierarchy, not really a history of movements, but that is not what you had in mind, right? What do we do if the history gets too long to fit, show scroll elements? One idea I had was to support a long click on back and forward, which could display a list of historic items to choose from. I'll look into the db. Did you mean to store responses there or requests? From what I saw I gathered that the response bodies are written to the file system in https://github.com/getinsomnia/insomnia/blob/cd4a983d5f41654f27c9c94d6c9d9f3a3e24fa64/packages/insomnia-app/app/network/network.js#L613 |
Beta Was this translation helpful? Give feedback.
-
That's what I was thinking but you might be right that it would be too long a lot of the time. The devtools shortening that you mentioned seems like a nice compromise.
This is a good point. I haven't seen breadcrumbs used in this way either. I like the idea of an additional horizontal bar (to differentiate things). Maybe, instead of breadcrumbs, the back/forward arrows could be there and the rest of the space could be filled by the current URL?
Correct, response bodies are stored to disk automatically. However, the actual response object needs to be saved to the local DB too. You can see where this happens for normal requests in |
Beta Was this translation helpful? Give feedback.
-
I am not good at explaining (or visualizing) ideas. I will try, however, because current workflow for me is exhaustive (and drives me away from an otherwise really well-thought program). PreludeSo far how the system is laid out to me, is that I have multiple MRU links/requests, and then I approach "actions" I'd like to execute / test / explore. Currently, my only possible way of working is if I generate a "template" request, and then have a buffer of Also, the only fast way to follow urls, is if I open then, F6; Ctrl+A the url, and return it in "another" "(Copy) (Copy) (Copy)" item. Fine-selecting a url with small font in a 4K screen is an annoying task. You cannot even Right-Click -> Copy URL in the preview. I would imagine that my flow would go a bit like this:
Then the program would, in a tree-like fashion:
Then, if you e.g. follow a url from the response:
And continue as such. It feels as this is somewhat-related to #447 This could all be searchable from a "free form search box". This mean it would also make it easier to have Back/Forward visualization, it could also show workflows of a specific process (e.g. "useful trees" could be marked with a 'green checkmark' which would only show checkmarked items and the "WIP" tree that has derived during that part) |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
Sorry, Stalebot was acting up since I change some of the label names! |
Beta Was this translation helpful? Give feedback.
-
In https://github.com/dschulten/insomnia/tree/feature/allow-opening-links-in-response I have prepared a feature branch where you could try out the current mechanism. It is very simple:
If that is useful, I can make it a PR |
Beta Was this translation helpful? Give feedback.
-
How is this looking? Seems like a nice feature to add as even right clicking on a link does not allow us to copy it, so we either must drag and copy, or click, open in browser then select and copy. |
Beta Was this translation helpful? Give feedback.
-
Seems stale both ways to me. I don't think it received a proper review, and there are some things in the air from owner's point of view. Honestly, I think @dschulten has had a pretty good idea of what everyone in this thread is requesting (and it is implemented), but the code needs to go through a quality gate. |
Beta Was this translation helpful? Give feedback.
-
Hello, Is this still planned? |
Beta Was this translation helpful? Give feedback.
-
+1. Recently moved from Postman to Insomnia, but still missing this feature in Insomnia to open a URL from a (JSON) response as a new (temporarily) request. |
Beta Was this translation helpful? Give feedback.
-
+1 This would be super helpful for my environments. |
Beta Was this translation helpful? Give feedback.
-
+1, but I would also add a copy button for the links in the response history |
Beta Was this translation helpful? Give feedback.
-
Hello, +1 for this basic feature. Besides the link recognition is already there (with strange default action: open a browser oO). Hope you will find time to implement it one day :) |
Beta Was this translation helpful? Give feedback.
-
I prefer Insomnia to Postman in most respects, but one feature I use a lot in Postman, and really miss, is the ability to follow links in the body of one request within Postmman.
I do a lot of work with an API that represents a tree structure with one node per request. The bodies of these requests contain URLs to their child node locations, so the ability to simply click one and have it followed immediately is extremely useful.
When I clink a link in the body of a request in Insomnia, it opens the link in my web browser. If I right click the link I just get an option to copy it. The only way I can see to open it in Insomnia is to copy the link, duplicate the current request (for headers, see below) and paste in the link I want to follow. This is fine to do occasionally, but its very frustrating if you regularly need to follow a lot of links.
For this to be really useful, there needs to be a way to propagate headers (mainly for auth, a custom API key header in our case). Postman handles this by allowing the current requests headers to be copied to the new request of the followed link. Another solution would be to allow setting common headers for a group of requests since not all headers are always required to be copied. I saw something along those lines suggested in another feature request.
I wouldn't want it to follow the link in the current request though. Opening it up in a new request is definitely the way to go. 👍
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions