Commit Graph
1 Commits
Author SHA1 Message Date
chrnx bc04330a27 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
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>
2026-10-24 22:36:18 -05:00