-
Notifications
You must be signed in to change notification settings - Fork 5
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
Allow setting a session with the expires prop set #13
base: master
Are you sure you want to change the base?
Conversation
The current code was setting the `expire` value always one day into the future even if the `cookie.expires` prop was set
from: https://github.com/expressjs/session
Can you address your use case by using maxAge instead of expires? From what I know using expires has become an anti-pattern as everyone that's running a global internet service can't really be dealing with time zones and so defining a relative maxAge in e.g. seconds is much better. If you're ok with using maxAge then I'd like to close this PR, thanks. |
I am not using express but fastify and fastify-session. Internally it is setting the expires prop even when I am setting the maxAge prop. I don't like this behavior and don't understand why they decided to always convert both the expires and maxAge prop to cookie.expires. Here in the test you can see what I mean. |
I've just seen that it is not fastify who came up with this design choice but express 😅
I think the issue here is not dealing with many time zones (because the Sorry for bothering you with this. I don't really like this design but I think your library would be the easiest place to "fix" the issue I have. Not sure if it's clever to ask the fastify maintainers to change the behavior of the maxAge prop who, I believe, would like to have a close API/behavior to express. |
I wasn't able to confirm this: |
I don't understand your problem. From my understanding, both express/session and fastify/session set both expires and maxAge in a similar way. |
The current code was setting the
expire
value always one day into the future even if thecookie.expires
prop was set.No worries, tests will follow 😅