R01010010 R01010010 - 6 months ago 10
Node.js Question

Express 4, how to see all cookies being sent in res

Hi all i'm using Express 4 with cookie-parser. For some reason the cookie is being set in the

res
object, but is not really stored in the browser. I wanted to see ALL cookies that are about to be passed at the end (all cookies for the current
response
object). Any idea on how to get them?

Answer

Use this:

console.log('Cookies: ', res._headers["set-cookie"]);

Explanation: As the cookies are set in the response header as "set-cookie" attribute.