Skip to content

Adds safe:true to set function. #61

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fatjonny
Copy link

Makes the functionality expected from calling req.session.save(fn)
actually happen by waiting for the response from the database
before calling the callback function.

For instance, if I want to set a variable on the session that has to
exist before redirecting I would want to do:

req.session.importantVariable = localImportantVariable;
req.session.save( function( err ) { res.redirect( '/superSecretUrl' ); } );

Without safe:true there is a chance that req.session.importantVariable
is not set when we get to /superSecretUrl and the behavior can be
inconsistent.

Makes the functionality expected from calling req.session.save(fn)
actually happen by waiting for the response from the database
before calling the callback function.
@fatjonny
Copy link
Author

I see that this is actually done in 98dfc41 from #60 if that gets accepted.

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.

1 participant