Skip to content

Commit

Permalink
Add previously set cookies to cookie header
Browse files Browse the repository at this point in the history
  • Loading branch information
misterpekert committed May 25, 2021
1 parent f281615 commit bdaafe4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/runtime/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,11 @@ export class Storage implements NuxtStorage {
document.cookie = serializedCookie
} else if (process.server && this.ctx.res) {
// Send Set-Cookie header from server side
this.ctx.res.setHeader('Set-Cookie', [serializedCookie])
const existingCookies = this.ctx.res.getHeader('Set-Cookie')
const cookies = Array.isArray(existingCookies)
? [...existingCookies, serializedCookie]
: [existingCookies, serializedCookie]
this.ctx.res.setHeader('Set-Cookie', cookies)
}

return value
Expand Down

0 comments on commit bdaafe4

Please sign in to comment.