Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do a loop with intellij http_client?

I would like to execute several http requests (in one http file) with intellij http client in a loop based on an array of strings in an environment file. Is this possible? If yes, how? Thx, Alex

like image 894
Alex Avatar asked Dec 18 '25 14:12

Alex


1 Answers

Yes, its possible. for example this will send 5 GET requests one for each id from an array.

< {%
    request.variables.set("id", [1,2,3,4,5])
%}
GET http://localhost:8080/books/{{id}}

You can find more examples in the documentation: https://www.jetbrains.com/help/phpstorm/http-client-variables.html#collections-in-variables

like image 112
Tymoteusz Motylewski Avatar answered Dec 21 '25 03:12

Tymoteusz Motylewski



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!