Hello everybody!
from the pre request I am executing a service and I want to capture the statusCode, I had tried this pm.test (“BadParams”, function () {pm.response.to.have.status (400);});
but this code only works for the test tab, for the pre request it gives me an error. they know if it is possible to do …
There might be some confusion around what “Pre-request script” is so let me clarify on this first
It works as following order: pre-request script → sending request → Tests
So pr-request script gets executed before the request is sent, so pre-request script does not know what the response would be (or what the response code would be).
I hope this makes sense but please do feel free to reach out if you have further questions
hi @taehoshino !
Thank you very much for taking the time to resolve my question.
Maybe I explained it wrong.
After researching I was able to figure out my code and it already does what I need.
I needed → pre request-> (get-> Response-> capture statusCode-> show Status)