Sysadmin by day, developer by night

Node.js uses a hash for the headers by default. This is great, until you need to send multiple headers with the same name, such as Set-Cookie. There’s some hacks out there people have done for cookies to make sure they work in all browsers. I guess Safari supports comma delimited headers so you can set multiple cookies with one header. However, my experience has been that multiple Set-Cookie calls works best What I did is extend the ServerResponse in the http module, adding writeHeadArray, which accepts an array of headers. This is a quick hack, if you set multiple cookies with the same name, all will get written to the browser. My experience is the cookie gets set to the value of the last cookie sent.

http://gist.github.com/350341

blog comments powered by Disqus
Technorati Profile