Hi All
I have tried various ways like using setNextRequest(null) or setting the response code 404 or using postman break or throwing an error but I am still unable to stop calling the main request from the pre-request script. Here is my pre-request code snippet :
pm.sendRequest('http://localhost:XXXX/xxxxxx/'+pm.environment.get("param1")+'/'+pm.environment.get("param2"), function(err, res){
//Check if callback returned error
if (res.code!= 200) {
console.log(res);
console.log("error code"+res.code);
console.log(res.status);
console.log(res.stream.toString());
postman.end();
// ------need to stop this from calling the actual request in postman
//postman.setNextRequest(null);
//pm..setNextRequest(null);
//pm.response.code=404;
//postman.break();
//throw err;
//return false;
}