From a101f8067d5e45b17226e8bde211435e3a4288d0 Mon Sep 17 00:00:00 2001 From: Yusuke Wada Date: Wed, 20 Apr 2022 17:57:02 +0900 Subject: [PATCH] fix: typo `SameSaite` (#159) * fix: typo * add test file --- src/middleware/cookie/index.test.ts | 4 ++-- src/middleware/cookie/index.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/middleware/cookie/index.test.ts b/src/middleware/cookie/index.test.ts index 23a3a396..2748599a 100644 --- a/src/middleware/cookie/index.test.ts +++ b/src/middleware/cookie/index.test.ts @@ -42,7 +42,7 @@ describe('Cookie Middleware', () => { app.use('/set-cookie-complex', cookie()) app.get('/set-cookie-complex', (c) => { - c.cookie('greate_cookie', 'banana', { + c.cookie('great_cookie', 'banana', { path: '/', secure: true, domain: 'example.com', @@ -60,7 +60,7 @@ describe('Cookie Middleware', () => { expect(res.status).toBe(200) const header = res.headers.get('Set-Cookie') 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' ) }) }) diff --git a/src/middleware/cookie/index.ts b/src/middleware/cookie/index.ts index d3b92546..13a0bbd7 100644 --- a/src/middleware/cookie/index.ts +++ b/src/middleware/cookie/index.ts @@ -79,7 +79,7 @@ const serialize = (name: string, value: string, opt: CookieOptions = {}): string } if (opt.sameSite) { - cookie += `; SameSaite=${opt.sameSite}` + cookie += `; SameSite=${opt.sameSite}` } return cookie