mirror of
https://github.com/honojs/hono.git
synced 2024-12-01 10:51:01 +00:00
parent
3e5171fe15
commit
a101f8067d
@ -42,7 +42,7 @@ describe('Cookie Middleware', () => {
|
|||||||
app.use('/set-cookie-complex', cookie())
|
app.use('/set-cookie-complex', cookie())
|
||||||
|
|
||||||
app.get('/set-cookie-complex', (c) => {
|
app.get('/set-cookie-complex', (c) => {
|
||||||
c.cookie('greate_cookie', 'banana', {
|
c.cookie('great_cookie', 'banana', {
|
||||||
path: '/',
|
path: '/',
|
||||||
secure: true,
|
secure: true,
|
||||||
domain: 'example.com',
|
domain: 'example.com',
|
||||||
@ -60,7 +60,7 @@ describe('Cookie Middleware', () => {
|
|||||||
expect(res.status).toBe(200)
|
expect(res.status).toBe(200)
|
||||||
const header = res.headers.get('Set-Cookie')
|
const header = res.headers.get('Set-Cookie')
|
||||||
expect(header).toBe(
|
expect(header).toBe(
|
||||||
'greate_cookie=banana; Max-Age=1000; Domain=example.com; Path=/; Expires=Sun, 24 Dec 2000 10:30:59 GMT; HttpOnly; Secure; SameSaite=Strict'
|
'great_cookie=banana; Max-Age=1000; Domain=example.com; Path=/; Expires=Sun, 24 Dec 2000 10:30:59 GMT; HttpOnly; Secure; SameSite=Strict'
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -79,7 +79,7 @@ const serialize = (name: string, value: string, opt: CookieOptions = {}): string
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (opt.sameSite) {
|
if (opt.sameSite) {
|
||||||
cookie += `; SameSaite=${opt.sameSite}`
|
cookie += `; SameSite=${opt.sameSite}`
|
||||||
}
|
}
|
||||||
|
|
||||||
return cookie
|
return cookie
|
||||||
|
Loading…
Reference in New Issue
Block a user