However, it’s not obvious how to create an asynchronous pre-request script, that is one that does not return instantly, but has to wait for some external factor (i.e. a HTTP Request), before completing the main request.
Here is the simple example, where we want to inject the user’s IP address into the HTTP request body before sending; as follows –
new Promise(resolve =>
And, the main request will not execute until the promise returned in the pre-request script is resolved.