fix(params): match @header names without case (GitHub #37) #171

Merged
chrnx merged 1 commits from fix/header-decorator-case into develop 2026-10-25 03:49:44 +00:00
Owner

Node's IncomingHttpHeaders and the fetch adapter's headersToRecord
both store request header names lower-cased, but resolveOne looked a
@header/@headers key up exactly as the decorator wrote it. Any name
with a capital letter, such as @header('Content-Type'), therefore
reached the handler as undefined.

resolveOne now lower-cases the key for the headers source before the
lookup. A picked bag (@headers([...])) keeps the names as written, so a
handler reads back the key it asked for; @headers() with no argument
still returns the whole lower-cased bag.

test/params.test.ts covers the single and picked forms on resolveArgs;
test/header-case.test.ts sends a request over app.fetch and the Node
server. All three fail without the fix.

Node's IncomingHttpHeaders and the fetch adapter's headersToRecord both store request header names lower-cased, but resolveOne looked a @header/@headers key up exactly as the decorator wrote it. Any name with a capital letter, such as @header('Content-Type'), therefore reached the handler as undefined. resolveOne now lower-cases the key for the headers source before the lookup. A picked bag (@headers([...])) keeps the names as written, so a handler reads back the key it asked for; @headers() with no argument still returns the whole lower-cased bag. test/params.test.ts covers the single and picked forms on resolveArgs; test/header-case.test.ts sends a request over app.fetch and the Node server. All three fail without the fix.
chrnx added 1 commit 2026-10-25 03:36:22 +00:00
fix(params): match @header names without case (GitHub #37)
CI / dco (pull_request) Successful in 4s
CI / runtimes (bun) (pull_request) Successful in 20s
CI / build (pull_request) Successful in 30s
CI / runtimes (edge) (pull_request) Successful in 19s
CI / runtimes (deno) (pull_request) Successful in 34s
bc04330a27
Node's IncomingHttpHeaders and the fetch adapter's headersToRecord
both store request header names lower-cased, but resolveOne looked a
@header/@headers key up exactly as the decorator wrote it. Any name
with a capital letter, such as @header('Content-Type'), therefore
reached the handler as undefined.

resolveOne now lower-cases the key for the headers source before the
lookup. A picked bag (@headers([...])) keeps the names as written, so a
handler reads back the key it asked for; @headers() with no argument
still returns the whole lower-cased bag.

test/params.test.ts covers the single and picked forms on resolveArgs;
test/header-case.test.ts sends a request over app.fetch and the Node
server. All three fail without the fix.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
chrnx force-pushed fix/header-decorator-case from 03def0324b to bc04330a27 2026-10-25 03:36:22 +00:00 Compare
chrnx merged commit 3fc43eb7ad into develop 2026-10-25 03:49:44 +00:00
Sign in to join this conversation.