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 e6035e3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/response.js
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,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 e6035e3

Please sign in to comment.