stealth.pda
(Alex Povolotskiy)
December 3, 2017, 9:12am
1
i trying to get some information in pre-request script in call another api. and i checking response and want to stop request if throw exception.
now i receiving message but my request could not to stop and i sent request with wrong data.
how to stop request from pre-request?
1 Like
Whersh
(wendall hershberger)
November 3, 2023, 4:05pm
2
I know this has been here for awhileβ¦but just wanted to give a proper response as there have been new developments around this.
For anyone just running across this issue as well
It looks like we are going to get this soon
opened 09:00AM - 13 Aug 20 UTC
closed 12:06PM - 16 Nov 23 UTC
feature
product/runtime
sandbox
In many other softwares pre-request script usually can stop continuing main oper⦠ation. Such as in git pre-commit script we can stop commit operation if we want, what is expected. But in postman pre-request script we can not stop request which is illogical. So postman pre-request script does not use its potential. I have found several years old fallback by throwing error but it is not good solution because in collection runner there are many red lines.
I have data file with e.g. 30 iterations but I do now want to run each iteration for each request. Some request are simple so I can not write 30 alternatives of variable value. SO I would like to add conditions in some requests... e.g. pseudo code...
`if (pm.info.iteration > 10)
pm.request.stop() // or pm.request.skip()`
Is it hard to add this feature? Is it planned samewhen?
β¦pm.execution.skipRequest()
. This function when used in Pre-request scripts will not execute the requestβ¦