Hi there,
I’m trying to get value from a cookie returned by the server in header to a GET request. I would like to use such value to next request (POST).
So far I was focused to print and save the value from the cookie, but I’m not able because uses CookieKey and StoredCookie objects and despite I read some of the email chains from the group, I couldn’t find the solution to my problem.
Some support would be really appreciated!
val allSteps =
exec(getRequestTime)
.exec( session => {
import io.gatling.http.cookie._
import java.net.URI
session(“gatling.http.cookies”).validate[CookieJar].map{
cookieJar =>
println(cookieJar)
}
session
})
The result of the println(cookieJar), is:
CookieJar(Map(
CookieKey(bwcfst,cc-test.sagecat.es,/cc/time) → StoredCookie(BWCFST=wYTtx6HUbUPsUDMiwzBBmgaxKJqWcMn0JDd5lqLWBLA; path=/catc/time; secure; HTTPOnly,true,false,1468232405357),
CookieKey(bwclocale,sagecat.es,/) → StoredCookie(bwCurrentLocale=en_US; domain=.sagecat.es; path=/,false,false,1468232405357),
CookieKey(jsessionid,catc-test.sagecat.es,/cc/time) → StoredCookie(JSESSIONID=vSxmpOMTLphT8SyOSMs9ScMwGMBlUV3Ku2IvdhKm.cca; path=/catc/time; secure; HTTPOnly,true,false,1468232405357),
CookieKey(jsessionid,catc-test.sagecat.es,/cc/access) → StoredCookie(JSESSIONID=V8Xk36hK5ocnDZ9YSwOgggm_xaMYPhhzbJ7SW38o.cca; path=/catc/access; secure; HTTPOnly,true,false,1468232405357),
CookieKey(csrftoken,sagecat.es,/) → StoredCookie(csrftoken=1877ad7e80abfb99442d736495a3aa89; domain=.sagecat.es; path=/; secure,false,false,1468232405357)
))
I would like to get value from ‘csrftoken’ (i.e: 1877ad7e80abfb99442d736495a3aa89), and store in session in order to be used by next request (POST request)
any ideas, please?
thanks a lot!!