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

Respect externalKey when removing session #171

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

Respect externalKey when removing session #171

wants to merge 1 commit into from

Conversation

rijx
Copy link

@rijx rijx commented May 3, 2019

I noticed that in one case koa-session tries to use cookies when you specified an externalKey: when destroying the session.

This simple fix should mitigate that by respecting the externalKey when removing sessions.

@coveralls
Copy link

coveralls commented May 3, 2019

Coverage Status

Coverage remained the same at 100.0% when pulling 2df2e36 on rijx:fix/consistent-external-key into 5ca903f on koajs:master.

@@ -279,7 +279,12 @@ class ContextSession {
const externalKey = this.externalKey;

if (externalKey) await this.store.destroy(externalKey);
ctx.cookies.set(key, '', opts);

if (opts.externalKey) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a test case for this fix?

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