3

I'm using supertest and trying to get the cookie data cleanly

agent.post('/login').send('username:u','password:p').end(function(err, res) { agent.cookie = res.req._headers.cookie; }); 

But to cookie data I get is jumbled up

connect.sid=s%3Afc20GaiFXGNju1rxqDSOEiA4.W3XfTacI0xhk4gQ9Bdh1LLC%2FlhjnAwVmQkUX%2F7%2FJEAo

instead of cleanly like this (and the above is even longer for some reason)

{ 'connect.sid': 'T0jrnU09DzCYN68FsgspuY5g' }

How do I get the latter?

1 Answer 1

2
require('cookie').parse(decodeURIComponent(cookie)) 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.