3

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
        ))
  }
4

1 回答 1

5

我最好的猜测是,这里的问题是您使用的baseUrl包含协议 - 例如https://www.google.com/等。

从我对该功能的实验来看,这是行不通的,cookie 需要仅传递域 - 例如www.google.com或如果您希望跨子域应用.google.com 则只需传递.google.com 。

于 2017-11-28T14:14:44.800 回答