Open max-l opened 5 years ago
@max-l thanks for the report! Unfortunately I have a hard time reproducing the issue with just the code you pasted above.
Would you mind creating a failing test case (e.g. in https://github.com/rjz/supertest-session/blob/master/test/main_spec.js) and submitting it as a pull request so that we can dig deeper into this issue?
have you find the problem ? i am having the same req.session.infoUser is undefined for me with jest but when i use postman it works
I have the followin test routes, the first sets a cookie, the second retrieves it.
I am using cookie-session: https://github.com/expressjs/cookie-session to handle sessions
When I test the above routes with a browser, it works as expected, and I can see that cookie-session sets two cookies, one for the session object, and one for the signature (session.sig), as the log shows:
cookie header: _ga=GA1.1.984665860.1553382018; session=eyJ2IjoicXEifQ==; session.sig=kJH4iEj4NkYR4HwYyo0QI42fF9A
When I use supertest-session, only one cookie gets set, as show by the log :
cookie header: session=eyJ2IjoicXdlcnR5In0=
Which causes cookie-session to not recognize the session, since it has no signature cookie.
The jest / supertest-session code is below.
Is there a way to tell supertest-session to persist all cookies set during a request ?