Gatling disableFollowRedirect without KO

Published: September 11, 2020

Tags:

I’m currently working on a Gatling simulation which involves sending traffic to an endpoint that issues an HTTP 307 response. For this load test I want to send requests to this endpoint, but I don’t want Gatling to follow the redirect. You can instruct Gatling to not follow the redirect by calling disableFollowRedirect:

http("My request")
    .get("/redirecting-url")
    .disableFollowRedirect

However, doing this will cause Gatling to flag the request as a KO, when the endpoint issues a 307 response.

This issue can be resolved by “whitelisting” the status code as expected via status.is.

http("My request")
    .get("/redirecting-url")
    .disableFollowRedirect
    .check(status.is(307))

Now Gatling will no longer report the request as KO.

Max Chadwick Hi, I'm Max!

I'm a software developer who mainly works in PHP, but also dabbles in Ruby and Go. Technical topics that interest me are monitoring, security and performance.

During the day I solve challenging technical problems at Something Digital where I mainly work with the Magento platform. I also blog about tech, work on open source and hunt for bugs.

If you'd like to get in touch with me the best way is on Twitter.