I’ve been trying to add cookies to my requests using addCookie action but it seems that Gatling is ignoring that.
I requested Gatling to print cookies sent in request:
.extraInfoExtractor(extraInfo => List(extraInfo.request.getCookies))
An entry from simulation.log shows that cookies are not sent in the request (the last element in the array, a collection, is empty):
Try 1022245772750469446-0 REQUEST search 1440576287486 1440576287662 1440576287698 1440576287699 KO status.find.in(200,304,201,202,203,204,205,206,207,208,209), but actually found 302 []
I also verified with proxy (Charles) to sniff the traffic coming from Gatling and it also was not seeing the cookie included, which suggests that it’s not problem with printing but rather that Gatling is not including cookies in the requests.
Gatling is also printing cookies included in the cookstore but mine (“SOMETHING”) is not there:
Session:
Session(Try,7988202680681807492-0,Map(gatling.http.cookies → CookieJar(Map(CookieKey(pref,google.com,/) → StoredCookie(PREF=ID=1111111111111111:FF=0:TM=1440577318:LM=1440577318:V=1:S=v_XjjA5ACrL5BPAY; domain=.google.com; path=/; expires=1451577737000,false,true,1440577318345), CookieKey(nid,google.com,/) → StoredCookie(NID=70=g5FwbH3OqSJreNSfMBNVJlV5BdV4rYD1ctKsNaqAbmkmPiqdGvMIwiZUR8yu67GwKT1HntP3vxFTFNjgzAZDV69isOQi4EH_uv8-Ci3_Q3wK3D9uGX2jWzvsJkXvOnw_; domain=.google.com; path=/; expires=1456388518000; HTTPOnly,false,true,1440577318346))), gatling.http.referer → http://www.google.com/?q=x),1440577318230,0,KO,List(),)
What am I doing wrong? I’m using Gatling 2.1.6. Below is my code to reproduce the problem.
Thank you,
Maciej
class Bug extends Simulation {
val httpConf = http
.baseURL(“http://www.google.com”)
.disableFollowRedirect
.extraInfoExtractor(extraInfo => List(extraInfo.request.getCookies))
.proxy(Proxy(“localhost”, 8888))
object NewPulsarSession {
val scn = scenario(“Try”)
.exec(addCookie(Cookie(“SOMETHING”, “58948498494894894894”)
.withDomain(“www.google.com”)
.withPath("/")
))
.exec(http(“search”)
.get("/")
.queryParam(“q”, “x”)
)
}
setUp(
NewPulsarSession.scn.inject(rampUsers(1) over (10 seconds))
)
.protocols(httpConf)
}