HI guys:
I have one question about set dynamic vlaue to header.
request_6 get dynamic value and saveAs(“csrf_token”). and request_7 will use headers_4, “X-CSRF-TOKEN” of headers_4 will be replaced with {“csrf_token”}
var headers_4 = Map(
“Content-Type” → “application/x-www-form-urlencoded; charset=UTF-8”,
“X-CSRF-TOKEN” → “7e0dce98-9832-4567-8b32-109c5ae88219”,
“X-Requested-With” → “XMLHttpRequest”)
.exec(http(“request_6”)
.get("/users/list")
.headers(headers_0)
.check(regex(“var everbridgeCSRF_TOKEN = ([^;])").saveAs(“csrf_token”))
)
.exec(session =>{
println("************************************”)
println(session(“csrf_token”).as[String])
session
})
.exec(http(“request_7”)
.post(uri1 + “/users”)
.headers(headers_4)
.header(“X-CSRF-TOKEN”, “${csrf_token}”) // codes in this line can not work.
.formParam("_search", “false”)
.formParam(“nd”, “1504580184806”)
.formParam(“size”, “25”)
.formParam(“page”, “1”)
.formParam(“sidx”, “lastname”)
.formParam(“sord”, “asc”)
.formParam(“filterRules”, “”)
.formParam(“firstName”, “tracy”)
.formParam(“lastName”, “”))
thanks,
Tracy