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

**URL:** <https://community.postman.com/t/how-can-one-terminate-executing-a-request-from-within-pre-request-script/7432>\
**Category:** Help Hub\
**Tags:** flow-control\
**Created:** [August 26, 2019, 8:39pm UTC](https://community.postman.com/t/how-can-one-terminate-executing-a-request-from-within-pre-request-script/7432 "2019-08-26T20:39:14Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![jonsworkalias](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/jonsworkalias/32/3153_2.png) [@jonsworkalias](https://community.postman.com/u/jonsworkalias)\
**Post date:** [October 5, 2019, 3:44am UTC](https://community.postman.com/t/how-can-one-terminate-executing-a-request-from-within-pre-request-script/7432/4 "2019-10-05T03:44:13Z")

</div>

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.

---

_[View the full topic](https://community.postman.com/t/how-can-one-terminate-executing-a-request-from-within-pre-request-script/7432)._
