Skip to content
Myr

test(context): assert case-insensitive header names in response helpers (#5116)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Yusuke Wada · committed by GitHub · parent b2ae3a2 · Browse files · 1 file+15 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+15 added−0 removed

  • tests:+15 added−0 removed

1 file+15 added−0 removed

modified:src/context.test.ts+15 added
490 unmodified lines
491 'X-Test': [],492 })493 expect(res.headers.get('X-Test')).toBeNull()494 })495496 it('Should override the default Content-Type even if the header name casing differs', async () => {497 const res = c.json({ type: 'urn:example:error' }, 400, {498 'content-type': 'application/problem+json',499 })500 expect(res.headers.get('Content-Type')).toBe('application/problem+json')501 })502503 it('Should apply the last value when header names differ only in casing', async () => {504 const res = c.body('foo', 200, {505 'X-Custom': 'first',506 'x-custom': 'second',507 })508 expect(res.headers.get('X-Custom')).toBe('second')509 })510})511512describe('Pass a ResponseInit to respond methods', () => {513 const req = new Request('http://localhost/')
99 unmodified lines