As mention at the tittle
Need a Pre-request-script that acts like this: if some variable === null then request its not sent, else request its send.
Context: For this API, DELETE request only applies if “variable” === “something” therefore when “Variable === null” tests fails and my automation stops.
I think you would have to do this in the ‘test’ tab of the first call so that you could query the HTTP response… Assuming that the first call is a “create” call, the “variable” would only be set to “something” after the first HTTP request was successfully executed right?
You could look at something like;
if (some variable === null) {
postman.setNextRequest(null);
}else{
postman.setNextRequest("Delete_Request");
}
Alternitively if you have to run this from a pre-req script and hardcode a variable then you would likely need to use pm.sendRequest()
First thank you for the answer. Problem is when value === null then “null” is not readable therefore can´t be stored in a variable. See attached captures.