Hi All,
Can anyone please help me on how to get response of the request and send it to another request. Please find below code.
.exec(http(“Create USer”)
.post(""“Urlxxxx”"")
.body(StringBody("""{“email":"sample@gmail.com”}"""))
.check(headerRegex(“Location”, “(.*)”).saveAs(“userId”))) // here i am saving this location value in üserId variable
// System.out.println("UserID: " + userId+ “\n”) // i tried to print like this, no use
//exec(
(s:Session) => println(s.getAttribute(“userId”)) // tried this also, but no use to conform what i am getting in UserId
)
val scn1 = scenario(“Identity”)
.exec(http(“request_0”)
.post("""/urlxxxx""")
.body(StringBody("""{
“username”:“anitha156”,
“password”:“anitha56”,
“userId”:"${userId}", // passing that userid in this request.
}""")))
}
Please help me on how to conform the value i am getting in Userid and how to pass this to next request???