Want to set 200 OK even if 404 NOTFOUND is observed

Hi All,

I have a scenario where “HTTP_404: NOTFOUND” is also the valid response. Now I want to set this status code to 200 OK even if 404 is observed. How can I do this in gatling ?

I can share here what I was doing in jmeter for this :


{ // Success
SampleResult.setSuccessful(true); // Change sampler status to success
AssertionResult.setFailure(false); // Set assertion status to success as well


status.is(404) or status.in(200, 404)

I tried to use .check(status.in(200, 404)) in that transaction but its not working.

I have two scenarios, where Login page can return 200 OK and 404 bith are valid. But if I am getting 404, it is found in KO group, I want to make that 404 to 200 and it should come in OK. Also If 404 is observed then scenario is stopping there and not moving forward to create new cart

Scenario I_CartNotFound : it should proceed and create new cart where this condition is applied .doIf(session => session(“c_CartId”).as[String]==null)
Scenario II_CartFound : It should proceed and update the cart (.doIf(session => session(“c_swySSOToken”).as[String]!=null))

Login Page can return

I tried to use .check(status.in(200, 404)) in that transaction but its not working.

Even I am having the similar scenario where 404 and 200 are valid status. Can anyone advise how to get this working.

The question is already answered in this thread.
Please check the documentation: Gatling - HTTP Checks