Unable to pass session value in request builder

Hi Stephane,

I am trying to do achieve the following actions

  1. Fetch a base64 encoded value from response header using headerregex and save to a variable - Done successfully

.check(headerRegex(“Content-Disposition”, “attachment; filename=aHR0cDovL3VhdHNpcXdfgfdhgXAud293Y29ycC5jb20uYXU—([^.]+)”).find.saveAs(“C_filename”))

  1. Then decoding the C_filename using a function text2BinaryDecoding() - done successfully

.exec(session => {
println(“Filename is given below:”)
println(session(“C_filename”).as[String])
val a = session(“C_filename”).as[String]
//(Base64.getEncoder.encode(response.body.bytes), UTF_8)
val de = hmac.text2BinaryDecoding(a)
println(de)
val me = de.replace(“https://wow-uat.signiq.net”, “”)
println(me)
session
}))

3. I need to use the data available in me in my below request - Unable to do

group(“A”)(exec(http(“B”)
.get("${today_1}") // need to pass the value from me
.headers(user_agreement_check)
.check(status.is(200))))

Solution tried by me:

.exec(session => session
.set(“today_1”, session(“me”).as[String]))

Tried setting the session value and use it in the request didn’t work

Could you please help on this one

Regards,
Aravind

Hi Aravind,

Presently, your code in “1.” does not save the “me” value.

.exec(session => {
println(“Filename is given below:”)
println(session(“C_filename”).as[String])
val a = session(“C_filename”).as[String]
//(Base64.getEncoder.encode(response.body.bytes), UTF_8)
val de = hmac.text2BinaryDecoding(a)
println(de)
val me = de.replace(“https://wow-uat.signiq.net”, “”)
println(me)
session.set(“me”, me)
}))

Hi Sébastien ,

Thanks a lot once again. Its working now. Its the same old cliché I missed what was there right infront of my eyes and you cracked it again. Have a nice weekend once again :)!

I tried the below during many of my trials

.exec(session => {
println(“Filename is given below:”)
println(session(“C_filename”).as[String])
val a = session(“C_filename”).as[String]
//(Base64.getEncoder.encode(response.body.bytes), UTF_8)
val de = hmac.text2BinaryDecoding(a)
println(de)
val me = de.replace(“https://wow-uat.signiq.net”, “”)
session.set(“fileurl”, me) // I tried this but it didn’t work ( is the session should be always set at the end ? )

println(me)

session
}))

Regards,
Aravind