val allCookies = session(“gatling.http.cookies”)
println("HERE ARE ALL THE COOKIES: " + allCookies)
val ck = session(“gatling.http.cookies”).as[CookieJar].get(URI.create("")).find(_.getName == “”)
println("HERE IS THE COOKIE: " + ck)
var cookieValue = ck.getOrElse(null).getValue
println("HERE IS THE COOKIE VALUE: " + cookieValue)
This code throws a compilation error “value setAttribute is not a member of io.gatling.core.session.Session” even though in https://github.com/excilys/gatling/wiki/Session it says that it should be a member. I’ve also tried using saveAs, but it gives the error “not defined for Option” or “not defined for String” depending on where I use it.
How can i pass this cookie value as a parameter to the next request?
I’m a complete beginner in Scala and Gatling btw.
val allCookies = session(“gatling.http.cookies”)
println("HERE ARE ALL THE COOKIES: " + allCookies)
val ck = session(“gatling.http.cookies”).as[CookieJar].get(URI.create("")).find(_.getName == “”)
println("HERE IS THE COOKIE: " + ck)
var cookieValue = ck.getOrElse(null).getValue
println("HERE IS THE COOKIE VALUE: " + cookieValue)
I understand that i didn’t return the new session but the old one, without the new session attribute added.
However I still don’t understand how to pass the cookie string value into the next exec http request? I only need to pass the value of a specific cookie as a parameter in the http request, nothing else.