How to partially set disableFollowRedirect=false with globally set it to true?

Hi All,
We try to use gatling for our testing driver to replace the old one, but I encounter one problem:

The requirement from my testing of login logic, which is some complex
The login has two part of redirect, for 1st redirect, I need to disableFollowRedirect as I need to find token in the redirected page:

group(“LoadLoginPage”) {
exec(
http(“req1”)
.get(host + “/” + contextRoot)
.check(status.is(302))
.check(header(“Location”).saveAs(“nextRedirectURL”))
)

.exec(
http(“req2”)
.get("${nextRedirectURL}")
.check(status.is(200))
.check(regex(“token = ‘(.+?)’;”).saveAs(“token”))
)
}

Then in next chains of redirect, I need to set disableFollowRedirect as false, as I need the server to do the redirect to another host for 3rd party authorization instead of gatling as client, the chain disableFollowRedirect = true as below

exec(
http(“reg3”)
.post("${nextRedirectURL}")
.formParam(“login”, “${username}”)
.formParam(“password”, “${password}”)
.formParam(“token”, “${token}”)
.check(header(“Location”).saveAs(“nextRedirectURL”))

)

.exec(http(“req4”)
.get("${nextRedirectURL}")
.check(header(“Location”).saveAs(“nextRedirectURL”))

)

.exec(
http(“reg5”)
.get(“nextRedirectURL”)
.check(status.is(200))
)

)

I checked the documents, seems no way to resovle it? So ask here whether I can implement this in some way? Thanks!

Could you please explain why you can’t let Gatling perform redirects automatically and let it deal with cookies transparently, just like a normal browser would?

Hi Stéphane,

Thanks for response!

The reason is in the first group: “LoadLoginPage”, need to save a token which will be used in req3 and that is a redirected page, so I need to disable auto redirect, and then in req4 need the server to do the redirect to another host for 3rd party authorization instead of gatling as client.

在 2016年7月19日星期二 UTC-7下午11:03:47,Stéphane Landelle写道:

From doc:

By default, Gatling follows redirects (can be disabled in the protocol). If this behavior is enabled, checks will ignore intermediate responses and will target the landing response.

Hi Stéphane,
yes, I read the doc, so it means that it can not switch during the testing?

Whether this will be a feature in next version?

Thanks!

在 2016年7月20日星期三 UTC-7下午10:45:23,Stéphane Landelle写道:

Hi Stéphane ,

Forget to update~~~

the problem has been resolved, it is not related for auto redirect, but other problem.

Nice performance testing tool:)

在 2016年7月20日星期三 UTC-7下午10:45:23,Stéphane Landelle写道: