Sanjeed
1
Im trying to create a payload having both feeder and session values, but it fails to read feeder value.
Any solution to this?
scenario(“check”)
.feed(ids)
.exec(http(“check”)
.post("/check")
.header(“X-Token”, session => session(“token”).as[String])
.body(StringBody(session =>
s"""
|{
| “id”: “${id}”,
| “subId”: “${subId}”
| “addressId”: “”"" + session(“token”).as[String] + “”""
|}
“”".stripMargin
))
sbrevet
2
IMO, the feeder set the variables directly in session.
With your example:
val token = “…”
val scn = scenario(“check”)
.feed(ids)
.exec(session => session.set(“token”, token))
.exec(http(“check”)
.post("/check")
.header(“X-Token”, “${token}”)
.body(StringBody(
“”"
|{
| “id”: “${id}”,
| “subId”: “${subId}”
| “addressId”: ${token.jsonStringify()}
|}
“”".stripMargin
))
Assuming that id and subId are coming from the feeder and token is a value.
Note:
- I put token in session
- I used EL String everywhere (no “s” before the string)
Sanjeed
3
Hey Thanks, the confusion is cleared now