In a GET request in Postman, I have added the script to the test section. The get request is run multiple times due to a page limitation. I am not able to collect all the data in one request. For the explanation, I grabbed a part of my code to make it as simple as possible.
In the items variable is an array of id's, which I set via the code below. After that I run the get request again:
pm.collectionVariables.set("array",JSON.stringify(items));
postman.setNextRequest("Get Products");
The result is that each time the Array collectionVariable is overwritten with the new items that I collected. What I want is to add them to the collection variable.
Have tried multiple things, such as:
pm.collectionVariables.set("array",(pm.collectionVariables.get("array") + JSON.stringify(items)));