diff --git a/plugin.js b/plugin.js index 8aec1ca..7fc28b2 100644 --- a/plugin.js +++ b/plugin.js @@ -40,9 +40,9 @@ function fastifyCookieSetCookie (reply, name, value, options) { function fastifyCookieClearCookie (reply, name, options) { const opts = Object.assign({ path: '/' }, options, { - expires: new Date(1), - signed: undefined, - maxAge: undefined + expires: new Date(0), + maxAge: 0, + signed: false }) return fastifyCookieSetCookie(reply, name, '', opts) diff --git a/test/cookie.test.js b/test/cookie.test.js index 7f277f1..77e1c22 100644 --- a/test/cookie.test.js +++ b/test/cookie.test.js @@ -224,7 +224,7 @@ test('share options for setCookie and clearCookie', (t) => { t.equal(cookies.length, 1) t.equal(cookies[0].name, 'foo') t.equal(cookies[0].value, '') - t.equal(cookies[0].maxAge, undefined) + t.equal(cookies[0].maxAge, 0) t.ok(new Date(cookies[0].expires) < new Date()) }) @@ -1054,7 +1054,7 @@ test('clearCookie should include parseOptions', (t) => { t.equal(cookies.length, 1) t.equal(cookies[0].name, 'foo') t.equal(cookies[0].value, '') - t.equal(cookies[0].maxAge, undefined) + t.equal(cookies[0].maxAge, 0) t.equal(cookies[0].path, '/test') t.equal(cookies[0].domain, 'example.com')