K6: Cookies don't appear to be working reliably


I am having a hard time getting Cookies to work in both .16 and .17. I believe this is healthy code, so not quite sure why this isn't working. I apologize if I am using an issue for support, but after spending a few hours on this it seems like a bug.

  let res = http.get(baseURL + "/users/sign_in");

  let formdata = {
    "utf8": "✓",

  res = http.post(baseURL + "/users/sign_in", formdata);

The response headers from the first request are:

HTTP/1.1 200 OK
Server: nginx
Date: Tue, 01 Aug 2017 04:25:38 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Cache-Control: max-age=0, private, must-revalidate
Etag: W/"d39c7d133c76b51c3f5ddbd33597fbd9"
Set-Cookie: _server_session=173e4634b9f5ec4f5e0db9e677af7c7a; path=/; HttpOnly
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-Request-Id: 1d6a0bfc-58a0-4c47-bde5-8bf7f2def0c2
X-Runtime: 0.019530
X-Ua-Compatible: IE=edge
X-Xss-Protection: 1; mode=block
Strict-Transport-Security: max-age=31536000
Content-Encoding: gzip

The second request headers are below. Note, no Cookies.

POST /users/sign_in HTTP/1.1
Host: xxx
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.78 Safari/537.36
Content-Length: 214
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip
lambertjosh picture lambertjosh  ·  1 Aug 2017

Most helpful comment


The code does indeed look fine, I'll have a look.

liclac picture liclac  ·  1 Aug 2017

All comments


The code does indeed look fine, I'll have a look.

liclac picture liclac  ·  1 Aug 2017

Thanks for fixing this, any chance for a release to homebrew? I'm unable to test sessions with this broken.

jsnod picture jsnod  ·  1 Aug 2017

I'll push a release in just a few hours, sorry for the delay! There are a couple of other things I want to include in it as well that I almost have all done already.

liclac picture liclac  ·  2 Aug 2017

Heads up, another delay, I'm stuck on a weird crash during some tests that I can't make heads or tails of; running from master wouldn't be a half bad idea if you're in a hurry.

liclac picture liclac  ·  3 Aug 2017