How to reference all instances created in a @loop statement?
See original GitHub issueI’m trying to create a test-script that calls a (POST) endpoint multiple times and then uses the results of each call in subsequence calls.
This is what I’ve tried:
# @name uuid
# @loop for 2
GET https://httpbin.org/uuid
###
# @ref uuid
# @loop for item of uuidList
POST https://httpbin.org/post
Content-Type: application/json
{
"item": "{{item.uuid}}"
}
Unfortunately this fails with:
ERROR: ReferenceError - uuidList is not defined
ReferenceError: uuidList is not defined
at Object.<anonymous> (demo.http:9:20)
at t9 ($HOME/.vscode/extensions/anweber.vscode-httpyac-5.4.1/dist/extension.js:151:40879)
at Object.nSe [as evalExpression] ($HOME/.vscode/extensions/anweber.vscode-httpyac-5.4.1/dist/extension.js:151:41428)
at bIt.iterateForOfLoop ($HOME/.vscode/extensions/anweber.vscode-httpyac-5.4.1/dist/extension.js:150:45758)
at iterateForOfLoop.next (<anonymous>)
at bIt.iterate ($HOME/.vscode/extensions/anweber.vscode-httpyac-5.4.1/dist/extension.js:150:45540)
at iterate.next (<anonymous>)
at bIt.beforeLoop ($HOME/.vscode/extensions/anweber.vscode-httpyac-5.4.1/dist/extension.js:150:45010)
at OW.<anonymous> ($HOME/.vscode/extensions/anweber.vscode-httpyac-5.4.1/dist/extension.js:1:4989)
at Generator.next (<anonymous>)
I know that using the <variableName>List
variable is an undocumented feature that I found while reviewing the code:
Is there maybe a better way of referencing all results of a @loop for n
statement?
Issue Analytics
- State:
- Created a year ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
How to create references to objects created in a loop?
Use an ArrayList: ArrayList<JButton> list=new ArrayList<>(); int numOfButtons = 10; for (int i = 0; i < numOfButtons; i++){ JButton jb=new ...
Read more >Iteration statements -for, foreach, do, and while - Microsoft Learn
You can step to the next iteration in the loop using the continue statement. ... All the sections of the for statement are...
Read more >Loops and iteration - JavaScript - MDN Web Docs
The for...of statement creates a loop Iterating over iterable objects (including Array , Map , Set , arguments object and so on), invoking...
Read more >Terraform tips & tricks: loops, if-statements, and gotchas
The for_each expression allows you to loop over lists, sets, and maps to create (a) multiple copies of an entire resource, (b) multiple...
Read more >For Loops, For...Of Loops and For...In Loops in JavaScript
All three expressions in the for loop are optional. For example, we can write the same for statement without the initialization expression ...
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 FreeTop 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
Top GitHub Comments
With v5.4.2 the fix for the bugs is released. Thanks for reporting.
Thanks for fixing this. I really appreciate it.