Hey me again. I need to maintain a session cookie across a user's
requests. I think the easiest way would be to extract the SET-COOKIE
header from my first request, save that to the session, and then
inject that into each subsequent request. Unfortunately I'm having
trouble with the first step. Here is what I'm trying:
val resourceGet = chain.exec(
http("getResources")
.get("/resources/1")
.headers(headers_1)
This doesn't work and i've tried other combinations like removing the
'find' but all throw errors something like:
/local/dev/gatling/user-files/simulations/20120131002614_scenario@default_scala.scala:258:
error: value find is not a member of
com.excilys.ebi.gatling.http.action.HttpRequestActionBuilder
So my first question would be how can I extract a header and save it
to a session variable?
Also from looking at the code it seems like headers expect 1 value for
a specific header name. For SET-COOKIE headers in particular it is
common to have multiple with the same name. Is there any way in
Gatling to extract the one I want? I would need to find the
SET-COOKIE header with a value like
"JSESSIONID=E2F98A8757AC931AEE67AAE5E3B769DC; Path=/" and then extract
the token from that.
i have a problem with this, when gatling automatically adds the cookie it looks like:
Cookie: JSESSIONID=
JZbAsTiFobLcVZHjjZO04a+o.6e350609-5758-3190-aec9-794334ced8d1;$Path="/Admin"
instead of
Cookie: JSESSIONID=JZbAsTiFobLcVZHjjZO04a+o.6e350609-5758-3190-aec9-794334ced8d1;Path=/Admin
I'm not getting my cookie set automagically so maybe you can help me
understand how the cookie handling works. Will the cookie be applied
to every request after it is set? Will it apply across different
chains as long as they're in the same scenario? Here's what i'm
trying to do
val chain1 = //some http call that will return multiple Set-Cookie headers
val chain2 = //a bunch of static content requests that don't require
the cookie is set
val chain3 = //another http cal that needs the cookie from chain1
val scn = scenario("...").insertChain(chain1).insertChain(chain2).insertChain(chain3)
But on the chain3 request it doesn't seem like the cookie is being set
in the request. The cookie should be set for all requests for a
particular user right? Is there any way for me to debug what gatling
is actually sending? Can I somehow config Gatling to print the full
request in the simulation.log? Or can I println session attributes
but so far I haven't been able to find what attribute the cookie is
set in.
I imagine I'm doing something wrong but I'm not sure the best way to
debug what Gatling thinks should be sent for each request.
Is the 'value=deleted' something that Gatling is doing? Is there any
way to tell it to retain the cookies over the life of a user's
session? I figure as a workaround I can manually extract the
'gatling.http.cookies' from the session and grab the cookie value and
then use it wherever I want. Gonna give that a shot right now.