Gatling 2: Example for saving the Cookie value from one exec and accessing from another exec

Hi, I am attempting to get Cookie value saved from one exec( ), and use it from the next exec( ).
This is what I have for that:

scenario(“Homepage”)

.exec(http("/homepage")

.get("/")

.check(headerRegex(“Cookie”, “”“SSID=([^”]+)""").saveAs(“sid”)))

.exec(session => {println("*** " + session(“sid”).as[String] + " ***");session})

However it doesn’t seem to work. Could someone show an example on read in data from a cookie and pass in to the next exec?

Thanks

Hu Mayumi,

Cookie header coming from the server to the client is named “Set-Cookie” (“Set-Cookie2” also exists but it’s rarely used and is deprecated), “Cookie” is the one the client sends back to the client. :slight_smile:

Cheers,

Stéphane