Disable automatic cookie handling?

I want to have my own cookie handling.

Gatling 3.3

No, it’s not.
Could you please explain how it would make sense to not have cookie handling working as specified in RFC6265?
What’s your use case exactly?

Hi Stéphane

Oh, I see. The wording on https://gatling.io/docs/current/http/http_helpers/ “Cookie support is enabled by default” seemed to imply there is a way to turn it off.

In my scenario, I have to deal with two cookies I want to use intermittently. I can store both in the session and apply the one I need in any given particular HTTP call.

The default Gatling approach overwrites the first cookie with the second one (while my own approach retains both and I can inject them directly in headers), as shown below.
Both cookies are issued by the same hostname, let’s say admin cookie and a user cookie:

override protected def setScenario(): ScenarioBuilder =
  scenario(getClass.getCanonicalName)
    .exec(postAdminLogin)
    .exec(postLogin)

    .exec(debugPrintSession)

POST /admin/login HTTP/1.1

< HTTP/1.1 302 Found
< Set-Cookie: PHPSESSID=qvpq3dkqcjo88pfk9o4cm8eu71; expires=Wed, 04-Mar-2020 15:50:59 GMT; Max-Age=2592000; path=/

POST /login HTTP/1.1
< HTTP/1.1 302 Found

< Set-Cookie: PHPSESSID=pp9rhofq02m6uk476mooph6780; expires=Wed, 04-Mar-2020 15:50:59 GMT; Max-Age=2592000; path=/

Session(io.gatling.stacker.scenarios.Sandbox,1,1580745055935,Map(gatling.http.cache.baseUrl → http://perfcomp, gatling.http.cache.dns → io.gatling.http.cache.DnsCacheSupport$$anon$1@e0654d5, adminCookie → PHPSESSID=qvpq3dkqcjo88pfk9o4cm8eu71, gatling.http.ssl.sslContexts → SslContexts(io.netty.handler.ssl.OpenSslClientContext@1fed69ad,None), gatling.http.referer → http://perfcomp, gatling.http.cookies → CookieJar(Map(CookieKey(phpsessid,perfcomp,/) → StoredCookie(PHPSESSID=pp9rhofq02m6uk476mooph6780, path=/, maxAge=2592000s,true,true,1580745059203))), userCookie → PHPSESSID=pp9rhofq02m6uk476mooph6780),29,OK,List(),io.gatling.core.protocol.ProtocolComponentsRegistry$$Lambda$387/1924990666@7e82439b)

Is there something I am missing?

Thanks!

Oh right, this sentence is indeed misleading, will fix.

Why don’t you Gatling cookie helpers to flush the cookie jar and add the cookie you need for the following request?

This is a solution I am thinking of, I just wondered if there is a more graceful one.

Thanks!