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 loves dabbling in other languages like Go and Ruby. Technical topics that interest me are monitoring, security and performance. I'm also a stickler for good documentation and clear technical writing.

During the day I lead a team of developers and solve challenging technical problems at Something Digital where I mainly work with the Magento platform. I've also spoken at a number of events.

In my spare time I blog about tech, work on open source and participate in bug bounty programs.

If you'd like to get in contact, you can find me on Twitter and LinkedIn.