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 Aug 1, 2024
1 parent 6a0a534 commit 48dfbd5
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 @@ -708,8 +708,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 48dfbd5

Please sign in to comment.