I created a method in collection level prerequest script as follows :
utils = {
testPMReq : function() {
console.log("I am here");
pm.sendRequest("https://postman-echo.com/get", function (err, response) {
console.log(response.json());
});
}
};
and then used this method in a post request test as follows :
utils.testPMReq();
It prints out: βI am hereβ but it doesnt execute the pm.sendRequest call.
When I call utils.testPMReq(); in collection level pre-prequest script right after method creation, it executes the send request call.
Can someone please help why sendRequest is not working when I execute the method from post request script and how I can make it work?