How to set a cookie for a Gatling scenario

Viewed 5140

I have the following code. The problem is that the cookie is not being set for the requests that follow.

I would like to set a single cookie that is used by all of the subsequent requests (including the ajaxRequests).

val get = scenario("Page")
  .feed(myfeed)
  .group("Home Page") {
    exec(session => setSessionVariables(session))
      .exec(addCookie(Cookie("mycookie", "true").withDomain(baseurl)))
      .exec(http("Home Page")
        .get(pageUrl)
        .resources(
          ajaxRequest01,
          ajaxRequest02
        ))
  }
1 Answers
Related