Reputation: 369
I'm trying to parse a response header value (which is a string) of one request into another method or function in gatling. Here is what I tried
val scn = scenario("DeviceAuth")
.feed(csvFeeeder)
.exec(http("Request1")
.post("endpoint")
.headers(headers_0)
.formParam("key", "value")
.check(headerRegex("header","pattern.*)").saveAs("value"))
.check(status.is(401)))
object getHeader{
def authenticationHeader: String = {
val header: String = "${value}"
val s = header.split("")
--so on and so forth--
}
}
So, when I tried to print the header value, it's just printed "${value}. How can we pass that value into my function?
Upvotes: 0
Views: 1026
Reputation: 1895
Please try this solution
val scn = scenario("DeviceAuth")
.feed(csvFeeeder)
.exec(http("Request1")
.post("endpoint")
.headers(headers_0)
.formParam("key", "value")
.check(headerRegex("header","pattern.*)").saveAs(value))
.check(status.is(401)))
object getHeader{
def authenticationHeader: String = {
val header: String = `$value`
val s = header.split("")
--so on and so forth--
}
}
Upvotes: 0