nuxt-community / google-optimize-module

SSR friendly Google Optimize module for Nuxt.js
MIT License
215 stars 32 forks source link

fix(plugin): do not overwrite existing cookie in res object #6

Closed williamchong closed 5 years ago

williamchong commented 5 years ago

Currently the cookie setting code overwrite any existing set-cookie header in pending response this PR fixes this by appending it instead

farzadso commented 5 years ago

@pi0 Do you have any opinions on this change? I think appending it is a better practice, unless you have any issues.

pi0 commented 5 years ago

This is a good fix. We also need it for universal-storage and auth to support multiple Set-Cookie calls in a single response.

farzadso commented 5 years ago

@pi0 Will you do the honours for the other modules?

pi0 commented 5 years ago

@farzadso for auth, I'll add it to current PR.

FYI regarding this change, express also do the same: https://github.com/expressjs/express/blob/b8e50568af9c73ef1ade434e92c60d389868361d/lib/response.js#L731

farzadso commented 5 years ago

Thanks Pooya