Hello,
I define the following collection-level pre-request script to be re-used by my collection’s requests:
utils = {
testAsync : function() {
pm.sendRequest(
{url : 'https://www.google.com'}, // URL set to Google for testing
(error, response) => {
console.log(response)
})
console.log("Exiting.")
}
}
However, when calling utils.testAsync()
in a pre-request script of any of my collection’s requests Postman does not wait for the callback to be executed before proceeding to the actual request. What would I need to modify to fix this?
The way of making code globally accessible is based on this answer on the forum.
Thank you
/David