-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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
[v4] Deprecate res.clearCookie
accepting options.maxAge
and options.expires
#5672
base: master
Are you sure you want to change the base?
[v4] Deprecate res.clearCookie
accepting options.maxAge
and options.expires
#5672
Conversation
@@ -822,6 +822,14 @@ res.get = function(field){ | |||
*/ | |||
|
|||
res.clearCookie = function clearCookie(name, options) { | |||
if (options) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry to make a comment on this again lol, take this as a nitpick, but if these checks were just made below line 833 they could assume opts
and just be the individual if's.
@@ -822,6 +822,14 @@ res.get = function(field){ | |||
*/ | |||
|
|||
res.clearCookie = function clearCookie(name, options) { | |||
if (options) { | |||
if (options.maxAge) { | |||
deprecate('res.clearCookie: Passing "options.maxAge" is deprecated and should be removed. Starting with the next major release of Express, this option will be ignored, as res.clearCookie will automatically set cookies to expire immediately. Please update your code to omit this option.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we call out v5.0.0
here so that we can be sure to not accidentally miss confusing folks in the future who may not know this was landed in v4?
closes #5640
Adds a deprecation notice when users pass a truthy value in
options
formaxAge
orexpires
when callingres.clearCookie(name, options)
.example:
Related #4852