Replies: 5 comments 9 replies
-
Hello @subnetmarco, are there any plans to include this post-request script feature in the upcoming releases? |
Beta Was this translation helpful? Give feedback.
-
To recap in the main thread, this capability will ship in a minor 9.1 immediately after 9.0 (when we ship pre-request scripting). |
Beta Was this translation helpful? Give feedback.
-
This issue has been fixed in 9.1 |
Beta Was this translation helpful? Give feedback.
-
@subnetmarco @ihexxa Will it be possible to manipulate the response (body/header)? Currently this is not possible current feature branches. Would be interesting, for example, if you want to chain requests to fetch auth tokens where you have to transform the responses |
Beta Was this translation helpful? Give feedback.
-
It would be great if Insomnia supported such thing. It is available in Postman (tab Tests) and allows for example setting environment variable from response. Insomnia support single environment variable from single requests, but sometimes it is required to set same environment variable from multiple requests (i.e. multiple variations of login requests that could set access token to environment variable, so it could be used by other requests). There is also issue requesting such/similar feature (#1968). It is also similar to discussed pre-request scripts in #3806.
There are probably many ways how to implement this, but personaly I find scripts to be most transparent, because all settings are within request configuration and are transfered upon reqest duplication and so on.
Maybe there could be even one tab Scripts and it could hold both pre-request and post-request scripts.
Are there any plans for such feature?
You can find my attempt on post request script at https://github.com/petoc/insomnia/tree/feature-script .
It definitely needs code refining.
Node's
vm
is used to execute javascript and exposes very basic insomnia API andconsole
. Script is saved for individual requests and should be also exported/imported together with requests.Probably
isolated-vm
would be better and more secure alternative to node'svm
, but I had some trouble getting it to work.Beta Was this translation helpful? Give feedback.
All reactions