Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/cookie.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = class Cookie {
if (request.protocol === 'https') {
this.secure = true
} else {
this.sameSite = 'Lax'
this.sameSite = 'lax'
this.secure = false
}
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"url": "git+https://github.com/fastify/session.git"
},
"devDependencies": {
"@fastify/cookie": "^10.0.0",
"@fastify/cookie": "^11.0.0",
"@fastify/pre-commit": "^2.1.0",
"@types/node": "^22.0.0",
"c8": "^10.1.2",
Expand Down
4 changes: 2 additions & 2 deletions test/session.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ test("clears cookie if not backed by a session, and there's nothing to save", as
})

t.assert.strictEqual(response.statusCode, 200)
t.assert.strictEqual(response.headers['set-cookie'], 'sessionId=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT; SameSite=Lax')
t.assert.strictEqual(response.headers['set-cookie'], 'sessionId=; Max-Age=0; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT; SameSite=Lax')
})

test("clearing cookie sets the domain if it's specified in the cookie options", async t => {
Expand All @@ -853,7 +853,7 @@ test("clearing cookie sets the domain if it's specified in the cookie options",
})

t.assert.strictEqual(response.statusCode, 200)
t.assert.strictEqual(response.headers['set-cookie'], 'sessionId=; Domain=domain.test; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT; SameSite=Lax')
t.assert.strictEqual(response.headers['set-cookie'], 'sessionId=; Max-Age=0; Domain=domain.test; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT; SameSite=Lax')
})

test('does not clear cookie if no session cookie in request', async t => {
Expand Down