how to parameterize header in recorded simulation.


I want to replace my session id in header map captured during simulation,

//this is what gets recorded.
//i want to replace “my_sessionid” with new value, I have generated, and say available in ${sessionId}

var headers_16 = Map(
“Accept” → “application/json, text/javascript, /; q=0.01”,
“Content-Type” → “application/json; charset=UTF-8”,
“Pragma” → “no-cache”,
“X-Requested-With” → “XMLHttpRequest”,
“my_locale” → “en”,
“my_offeringenv” → “prf”,

"my_sessionid" → “7C778BA2A39345418CCE127DEAC95444”)//—>>>> need to parameterize thius value

//In my script
//this doesnt work

.header(“my_sessionid”,"""${sessionId}""")// ---->>> this doesnt work as rest of the header values dont get loaded

.post(uri1 + “/validate_email”)

Also headers seems to accept only immutable Map, hence not able to use mutable map, where I can programmatically alter the value.

Seems like I’m missing something very basic. Will appreciate any guidance.


In your map headers_16:

"my_sessionid" → "${sessionId}"

Then .headers(headers_16)

That works for me, at least. Pretty sure headers can resolve the EL Strings in the map. Best of luck.

That worked! Thank you Andrew, appreciate your quick response.