-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cookies without an expiration date are also saved #26
base: master
Are you sure you want to change the base?
Conversation
Thanks for your interest in this project! I just had a look at the change and I think it can be solved more elegantly. The check Maybe the |
It is true that the problem can be solved by sending true in save. This is not interesting because hasExpired is not checked and the cookie is always saved, and this was the case that I was solving this way and I think it was wrong. I already wrote about this at #25 which you read. |
I don't understand, I thought about it, and I think you're saying that node-fetch-cookies should always save session cookies, no matter the However, I'm not sure if I agree to always saving session cookies. Usually, you only load cookies from a file on application startup, which would define the start of a new session for me. Similarly, a browser also doesn't save session cookies, it only keeps them for a session, i.e. until it is restarted. However, I can see that you might want to keep a session across application restarts, i.e. why one would want to save session cookies. |
Currently, the problem is that hasExpired treats cookies without an expiration date as expired and does not store them, while we need to store them just like a browser would. |
This isn't correct, if the parameter to node-fetch-cookies/src/cookie.mjs Lines 150 to 155 in db40f03
The above code only returns true in 2 cases:
In all other cases, the function returns false. If this library really saves expired cookies for you we'd have to investigate it, please post examples of it in this case, as I don't see how that would be possible just by looking at the code. |
Details: #25