My requirement is like one user logs in create somethimg and then other user logs in and updates it.
Feeder is csv as below
User1, user2
1001,4001
1002,4002
1003,4003
Val createProduct =
exec(http("login")
.post("/login")
.formparam("user","${user1}")
.formparam("pwd","5656666"))
.exec{session=>
getCookievalue(CookieKey(XSRF-TOKEN)).saveAs("XSRF-TOKEN")
}
.exec(http("create")
.post("/create")
.header("x-xsrf-token","${XSRF-TOKEN}"
.body())
.exec(http("logout")
.get("logout"))
.exec(http("login2")
.post("/login")
.formparam("user","${user2}")
.formparam("pwd","5656666"))
.exec{session=>
getCookievalue(CookieKey(XSRF-TOKEN)).saveAs("XSRF-TOKEN")
}
.exec(http("update")
.post("/update")
.header("x-xsrf-token",getCookievalue(CookieKey(XSRF-TOKEN))
.body())
.exec(http("logout")
.get("logout"))
Val scenario= Scenario("test").feed(feeder)
.exec(createProduct)
Setup(scenario.inject(rampusers(8) during(10 seconds))
Ignore any typos.
My issue is when the second user logs in and tries to update the product, its getting the XSRF-TOKEN same as from the first user session.
Is there anything i am missing here.
Thanks in advance.