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

Don't set the cookie flag if it has a falsy value in the options object #42

Closed
wants to merge 1 commit into from

Conversation

papandreou
Copy link

Hey, thanks for a nice lib!

I found it a bit unintuitive that a flag is set if I specify it with a falsy value in the options object, eg.:

hardtack.set('foo', 'bar', {
  secure: location.protocol === 'https:'
});

Fix it by ignoring flags passed as false, undefined, or null, but don't break maxAge: 0.

Sorry for blowing the size budget ;)

@coveralls
Copy link

coveralls commented Feb 9, 2019

Coverage Status

Coverage remained the same at 100.0% when pulling db69f0a on papandreou:fix/falsyOptionValue into 853ae41 on alik0211:master.

@alik0211
Copy link
Owner

It's good PR, but I'm not merge.

Handling false, undefined, null is not a task for such a small library. Similar functionality was removed in #41 and I don't expect to ever return.

@alik0211 alik0211 closed this Feb 10, 2019
@papandreou
Copy link
Author

I think that's too surprising, people will expect it to work like that. It sounds like you're knowingly creating a footgun. At least consider documenting it, then.

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.

3 participants