From 85900b76065ee1185fef284faaacde1979298718 Mon Sep 17 00:00:00 2001 From: Yusuke Wada Date: Wed, 15 Jul 2026 08:54:29 +0900 Subject: [PATCH] test(context): assert case-insensitive header names in response helpers --- src/context.test.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/context.test.ts b/src/context.test.ts index 48607c3134..a8a5dd2ed0 100644 --- a/src/context.test.ts +++ b/src/context.test.ts @@ -492,6 +492,21 @@ describe('Context header', () => { }) expect(res.headers.get('X-Test')).toBeNull() }) + + it('Should override the default Content-Type even if the header name casing differs', async () => { + const res = c.json({ type: 'urn:example:error' }, 400, { + 'content-type': 'application/problem+json', + }) + expect(res.headers.get('Content-Type')).toBe('application/problem+json') + }) + + it('Should apply the last value when header names differ only in casing', async () => { + const res = c.body('foo', 200, { + 'X-Custom': 'first', + 'x-custom': 'second', + }) + expect(res.headers.get('X-Custom')).toBe('second') + }) }) describe('Pass a ResponseInit to respond methods', () => {