How Can One Terminate Executing a Request From Within Pre-Request Script?

I have a similar scenario, and what I do is build my full list of items from an array stored in an env variable , and then filter it based on some criteria, and make a call for each one of these from the pre-test tab using a function that does a sendRequest call and logs the responseBody to a env variable per request. These requests all fire off at once and log results. You can’t interact with the results on the pre-test tab because they’re called async.

Then in the Test tab I read my array again from env variable, do my filter and use that to know what env variables I made (each element has an ID and i use the ID to name the variable where the response body was saved.) I do a new loop and call a function to process the data, and do a pm.environment.unset(“IDn”) on each loop, to clean things up.

So, the actual call being made is not really meaningful, it is just what is used to allow for triggering pre and post calls.

1 Like