diff --git a/src/request.test.ts b/src/request.test.ts index 61654c130..11f85fb30 100644 --- a/src/request.test.ts +++ b/src/request.test.ts @@ -161,6 +161,20 @@ describe('headers', () => { const foo = req.header('foo') expect(foo).toEqual('') }) + + test('Keys of the arguments for req.header() are not case-sensitive', () => { + const req = new HonoRequest( + new Request('http://localhost', { + headers: { + 'Content-Type': 'application/json', + apikey: 'abc', + lowercase: 'lowercase value', + }, + }) + ) + expect(req.header('Content-Type')).toBe('application/json') + expect(req.header('ApiKey')).toBe('abc') + }) }) const text = '{"foo":"bar"}' diff --git a/src/request.ts b/src/request.ts index 68c710c35..647129ab7 100644 --- a/src/request.ts +++ b/src/request.ts @@ -178,7 +178,7 @@ export class HonoRequest
{
header(): Record