[Bug] Extracting substring to token value doesn't reference tag properly
See original GitHub issueI’d need to chain certain requests. In the middle of the chain I’d need to parse a substring from a response JSON field and use that value in the next step. I couldn’t find out way to do this. Is it possible somehow?
Example:
Response body
{
  "url": "https://redirect.to?code=abc123"
}
And I’d like to extract the code query param value from the $.url field.
Issue Analytics
- State:
 - Created 4 years ago
 - Comments:8 (5 by maintainers)
 
Top Results From Across the Web
[Bug] Extracting substring to token value doesn't reference tag ...
I'd need to chain certain requests. In the middle of the chain I'd need to parse a substring from a response JSON field...
Read more >Extracting part of a string on jenkins pipeline - Stack Overflow
In this case, it looks like using a few Groovy/Java methods on the String can extract the parts. final beforeColon = url.substring(0, url....
Read more >Allow searching for part of a word (prefix / substring searches)
In our projects we need to search for the word "ComboBox" or "Box" or just "box", but it does not retrieve the issues...
Read more >$EXTRACT | InterSystems IRIS Data Platform 2022.2
EXTRACT - Extracts a substring from a character string by position, or replaces a substring by position.
Read more >Everything you need to know about Regular Expressions
After reading this article you will have a solid understanding of what regular expressions are, what they can do, and what they can't...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

You’ll have to store the response value in a temporary environment variable first.
For example:
Is this for OAuth 2.0? If so, have you tried using Insomnia’s built-in OAuth 2.0 support?
I spent some time investigating this one, and here are my findings. There isn’t an issue with how a variable is resolved for a request, there is a more fundamental issue with resolving variables, because I managed to reproduce this bug within the environment variable editor.
If the piped variable is coming from a block using
insomnia-plugin-response, we see this behaviorAnd if the piped variable is coming from a regular string, we see this behavior
It seems there is an issue with nunjucks, when nesting
variable <- variable <- block, whilevariable <- variable <- variableworks.I can see some interesting behavior inside the
templating.render, when we call the nunjucks renderString method, but I’m going in circles at this point and need to bounce some ideas I think.https://github.com/Kong/insomnia/blob/e485d55aea4fd2edf09088feeecb4d19a1c75d7f/packages/insomnia-app/app/templating/index.js#L42-L46