Skip to content

Commit

Permalink
explicitly delete maxAge instead of setting as undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
jonchurch committed Jul 27, 2024
1 parent bcf4b07 commit 4668a6e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/response.js
Original file line number Diff line number Diff line change
Expand Up @@ -698,8 +698,9 @@ res.get = function(field){

res.clearCookie = function clearCookie(name, options) {
// Force cookie expiration by setting expires to the past
// ensure maxAge is undefined
const opts = {path: '/', ...options, expires: new Date(1), maxAge: undefined}
const opts = { path: '/', ...options, expires: new Date(1) }
// ensure maxAge is not passed
delete opts.maxAge

return this.cookie(name, '', opts);
};
Expand Down

0 comments on commit 4668a6e

Please sign in to comment.