Skip to content

Adds safe:true to set function.#61

Open
fatjonny wants to merge 1 commit intotreygriffith:masterfrom
BouncingPixel:sessionSaveCallback
Open

Adds safe:true to set function.#61
fatjonny wants to merge 1 commit intotreygriffith:masterfrom
BouncingPixel:sessionSaveCallback

Conversation

@fatjonny
Copy link
Copy Markdown

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
Copy Markdown
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