Hello, I have a scenario that executes the following to get some values:
val getToken = feed(Properties.userCredentials)
.exec(
http(“GetToken”)
.post(…)
.header(“Content-Type”, “application/x-www-form-urlencoded”)
.header(…)
.queryParam(…)
.check(headerRegex(“tuidsession”, “(.*)”).exists.saveAs(“sessionKey”))
.check(headerRegex(“userid”, “(.*)”).exists.saveAs(“userId”)))
.exec(Pause.reqPause)
The values I’m interested in “userId” and “sessionKey”, and I know that they are being returned correctly.
In a subsequent call, I need to make the value of “userId” and “sessionKey” available to a method call to build a string prior to executing a Gatling API:
val uploadSDl = exec(
http(“UploadSD”)
.post(…)
.header(…)
.header(“sdsignature”, CryptoUtils.sign(“POST /users/” + session(“userId”).as[String] + “/tuid/” + Properties.tuid + “/upload”, session(“sessionKey”).as[String]))
.header(“Content-Type”, “multipart/form-data; boundary=---------------------------1234567890”)
.formUpload(“video”, Properties.smallFlvFileName))
.exec(Pause.reqPause)
However, I don’t seem to be able to access the values in the session:
session(“userId”).as[String]
and
session(“sessionKey”).as[String]
both give me the error: “not found value session”
I’ve also tried the underscore approach, to no avail.
How do I get at those values?
thanks
Wayne