1

I am trying to create a conditional workflow using setNextRequest. This workflow should do subsequent API call only when statuscode of current call is 201

My test looks something like this

var returnData = JSON.parse(responseBody);
tests["status code"] = (responseCode.code === 201);
if (responseCode.code == 201) {
    postman.setNextRequest('ConfigurationModel-Module');
}

But even when my API response is 409 subsequent API call are triggered in postman runner

Dharman
  • 30,962
  • 25
  • 85
  • 135
Ankit
  • 11
  • 1
  • What i'm seeing is bit strange . the first request goes in , fails(gives 409) the test but triggers the next request. Basically if (responseCode.code == 201) does not get evaluated!!! – Ankit Apr 05 '19 at 08:59

1 Answers1

1

Depending on what you're doing you can add an else statement

else
 postman.setNextRequest(null);
Yaakov Bressler
  • 9,056
  • 2
  • 45
  • 69