Hello, I created a collection form 5 POST request. The first request is for getting token and I want to execute the request only once on first iteration. After that to start from the second. For example : iteration 1 → Resquest 1,2,3,4,5 and Iteration 2 → Request 2,3,4,5.
That what I did is to create undefind global variable “firstRequestExecuted”
I put below if statments in pre-request with the idea :
iteration 1 → first if set the value of global variable to true.
iteration 2 → second if , check if global variable “firstRequestExecuted” is true proceed with request 2.
if (typeof pm.globals.get (“firstRequestExecuted”) === ‘undefined’) {
pm.globals.set(“firstRequestExecuted”, true);
}
if (typeof pm.globals.get(“firstRequestExecuted”) === true) {
pm.execution.setNextRequest(“SecondRequest”);
}
Please help. What i am doing wrong ?
First request for getting the token is executed every iteration.