Skip to content
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

fix: Don't refresh session on each request #148

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jack-y
Copy link

@jack-y jack-y commented Feb 26, 2021

New option: rolling.
Checks if we force the session identifier cookie to be set on every response.
Default = true.
Same approach as express-session.
See: https://github.com/expressjs/session#rolling

Usage:

fastify.register(fastifySession, {
  ...
  rolling: false, // don't force the session cookie to be set on every response
  ...
});

Hope it helps!

@jack-y jack-y changed the title fix: Don't refresh session on each request #126 fix: Don't refresh session on each request Feb 26, 2021
@coveralls
Copy link

Coverage Status

Coverage decreased (-4.1%) to 95.89% when pulling e11198c on jack-y:options-rolling into e201f78 on SerayaEryn:master.

@mfpopa
Copy link

mfpopa commented Aug 3, 2021

Fixes #126

@mfpopa
Copy link

mfpopa commented Aug 3, 2021

@jack-y Except the refactoring suggestion I have just made, the only other thing missing is changes to the TypeScript types, https://github.com/SerayaEryn/fastify-session/blob/master/types/types.d.ts to add the rolling option as a boolean to the Options interface.

Ah, also missing tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants