Home

Issue: 734

Cannot set multiple 'Set-Cookie'

[issue link]

Version:

macOS 10.12.5
Chrome 60.0.3100.0

yarn 0.24.5
node v7.10.0

cookie 0.3.1
nuxt 0.10.7

Code example:

import Cookie from 'cookie'
export default {
  // ...
  async asyncData ({ res }) {
    // ...
    res.setHeader('Set-Cookie', [
      Cookie.serialize('__test_cookie1', 'cookie1', {
        maxAge: 60 * 60 * 24 * 7,
        path: '/'
      }),
      Cookie.serialize('__test_cookie2', 'cookie2', {
        maxAge: 60 * 60 * 24 * 7,
        path: '/'
      })
    ])
  }
}

Response header:

HTTP/1.1 200 OK
Set-Cookie: __test_cookie1=cookie1; Max-Age=604800; Path=/,__test_cookie2=cookie2; Max-Age=604800; Path=/
Content-Type: text/html; charset=utf-8
Content-Length: 29020
Date: Thu, 18 May 2017 08:41:32 GMT
Connection: keep-alive

Now i use document.cookie:

__test_cookie1=cookie1

Why the __test_cookie2 is not generated ?

This question is available on Nuxt.js community (#c627)