Hi,
I think I'm just not up to speed enough with Scala to figure this out (using 2.0.0-SNAPSHOT from about a week ago) . I have a call which returns with some cookie values set, I need to grab one of these values and store it for POST'ing later:
val chain_2 = exec( http("Get XTOK")
.get("""/portal/rest/contract/unassigned/count""")
.exec( session => {
import io.gatling.http.cookie._
import java.net.URI
session("gatling.http.cookies").validate[CookieJar].map{
cookieJar =>
//val cookie = cookieJar.get(URI.create("10.18.8.30")).find(_.getName == "xtok")//_.getName == "domain")
println(cookieJar)
//cookie.map(session.set("myCookieValue", _)).getOrElse(session)
}
//println(session("myCookieValue"));
session
})
this prints :
CookieJar(Map(10.18.8.30 -> List(xtok=45695e2e-0a12-081e-00fe-b4052c4d6ed5; domain=10.18.8.30; path=/, JSESSIONID=pDRnTDnMs8v5Dw7GfBlBG62NnH2RrjqmKCR3kvGpvL9cyGtX53TS!-1606261601; domain=10.18.8.30; path=/; HTTPOnly)))
but I cannot figure out how to extract xtok from this - the code I have commented out throws :
[ERROR] [02/18/2014 14:37:59.050] [GatlingSystem-akka.actor.default-dispatcher-7] [akka://GatlingSystem/user/$d] null
java.lang.NullPointerException
at io.gatling.http.cookie.CookieJar$.io$gatling$http$cookie$CookieJar$$requestDomain(CookieJar.scala:29)
Thanks
Al