Gasim
Gasim

Reputation: 7961

Gatling overrides `Cookie` header with the `Set-Cookie` header of previous response

I have an http request in Gatling that gets executed 10 times:

val scnProxy = scenario("Access proxy")
  .exec(session => session.set("connect.sid", sessionId))
  .repeat(10) {
    exec(
      http("Access endpoint")
        .get("/my-api")
        .header(
          "Cookie",
          session => "connect.sid=" + session("connect.sid").as[String]
        )
        .check(status is 200)
    )
  }

For some reason, I get the intended response only on the first iteration. On every other iteration, I keep getting 401. So, I changed log level to TRACE to see what the problem is and found a weird behavior. For the first iteration, I get the header Cookie: connect.sid=... but for some reason, on second and other iterations, the cookie parameter gets overridden by the set-cookie of the previous request. Since Cookie header value is a string, it does not merge these cookies.

Is there a way that I can add a cookie instead of my cookie getting overriden?

Upvotes: 1

Views: 1952

Answers (1)

Related Questions