Add second cookie to session.

Hi (Gatling 2, I have read documentation)

I need too add second cookie to each header. For now I am able to add it as a static value in header.

val header_with_secondCookie = Map("Cookie" -> "firstCookie=01; secondCookie=${secondCookie}")

val postLoginAndPass = exec(
  http("request_1").post(uri2 + "/json/authenticate").headers(header_with_default_cookie)

val schouldGetWithNewSecondCookie = 
    .get(uri2 + "/user")

Maybe there is some way to add second cookie to session…?

After DEBUGGING session I noticed that method
exec(flushSessionCookies) works. Session cookies are dropped.

Now I need to add new cookie inside session, but method
exec(addCookie(Cookie(“name”, “value”))) does not work at all.

val scn = scenario("BasicSimulation") .exec(http("request_1").get("/")) .exec { session => println("My session before: " + session) session } .exec(addCookie(Cookie("name", "value"))) .exec { session => println("My session ater: " + session) session }

So, sessions before and after are identical. No changes.
How to add cookie to session manually, when addCookie figure doesn’t help.


What version of Gatling are you using ? This was a bug in previous versions that was corrected in 2.1.6 or 2.1.7.

Also, addCookie won’t work without a baseURL set on the protocol level.





Could you give me some tip how to set up baseURL and cookie together into the session?

My Cookie jar is sth like


gatling.http.cookies → CookieJar(Map(CookieKey(amlbcookie,,/) → StoredCookie(amlbcookie=01;; path=/,false,false,1446644285856))))

And I need to add second cookie (or replace old one)


W dniu czwartek, 5 listopada 2015 09:30:16 UTC+1 użytkownik Guillaume Corré napisał:

We release milestones for our customers when they need them.
You can use them, but at your own risks: they are not documented, and might contain bugs that are fixed in the master and/or the latest stable version (which is currently 2.1.7).

Thanks for explanation.

After downgrade to 2.1.7 everything is OK.

W dniu czwartek, 5 listopada 2015 11:14:27 UTC+1 użytkownik Stéphane Landelle napisał: