pillarjs / cookies

Signed and unsigned cookies based on Keygrip
MIT License
1.29k stars 152 forks source link

Getting cookies of a request without having to pass response argument #127

Closed ghost closed 4 years ago

ghost commented 4 years ago

Hi! I need to get a certain cookie when the server emits the 'upgrade' event:

server.on('upgrade', (request: IncomingMessage, socket: Socket, head: Buffer) => {
    // get request cookie here
})

Is it possible to do this? From what I can see inspecting the source code it should be, but if I emit the response parameter typescript complains. Is this a @types/cookies issue then?

dougwilson commented 4 years ago

We have a lower level module mode made for your use case, does that work for you? https://github.com/jshttp/cookie

ghost commented 4 years ago

Great! Thank you.