WebSocket-Node icon indicating copy to clipboard operation
WebSocket-Node copied to clipboard

Refactor Cookie-handling code into module or delegate to another NPM module

Open theturtle32 opened this issue 10 years ago • 2 comments

theturtle32 avatar Nov 17 '14 23:11 theturtle32

Why not provide them as a simple string like in a http header?

The current format requires me to do an additional transformation which I'd like to avoid.

silverwind avatar Jan 31 '15 20:01 silverwind

Because parsing the cookies allows me to enforce validation of correct formats. I feel that libraries like this have a responsibility to enforce correct RFC-compliant usage.

True, the format of the parsed cookies isn't the most convenient, but the transform you're doing is super lightweight and fast.

Also, I'm not 100% certain my memory is correct, but the spec may allow multiple cookies with the same name, the same way that HTTP allows multiple headers with the same name.

theturtle32 avatar Jan 31 '15 21:01 theturtle32