Please see the communication description
- Client --- POST /login (no cookie yet) ---> Node Server
- Node Server ---> ‘set-cookie’ : ‘…’ -> Client (sets cookie and uses it for next requests)
How could I get encoded value of the cookie which is set as a set-cookie header before it is sent to the client on the first request ?
Express 3.x, cookieParser, expression-session and a mongo as a storage are used.
I tried:
- to access
req.cookiesbut is not populated on the first request because client doesn't have a cookie yet. res.getHeader('set-cookie')returnsundefinedperhaps because it is set after express route handler is called by express-session.
At the server side how could I access either a set-cookie header in my handler or the cookie value in the response object even if request.cookie is empty ?
res.getHeader('set-cookie')it returnsundefined. That's why I wonder if there is some special trick to do it.