Skip to content

Bun.serve: treat empty header values as absent so auto Content-Type/Date are not duplicated - #35336

Open
robobun wants to merge 7 commits into
mainfrom
farm/c48b394b/serve-empty-header-dup
Open

Bun.serve: treat empty header values as absent so auto Content-Type/Date are not duplicated#35336
robobun wants to merge 7 commits into
mainfrom
farm/c48b394b/serve-empty-header-dup

Bun.serve: treat empty header values as absent so auto Content-Type/D…

91e3321
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Jul 24, 2026 in 19m 15s

Code review found 1 important issue

Found 1 candidates, confirmed 1. See review comments for details.

Details

Severity Count
🔴 Important 1
🟡 Nit 0
🟣 Pre-existing 0
Severity File:Line Issue
🔴 Important src/jsc/bindings/NodeHTTP.cpp:798-805 Static/File routes still emit lone empty Date/Content-Type — sibling serializer not fixed

Annotations

Check failure on line 805 in src/jsc/bindings/NodeHTTP.cpp

See this annotation in the file changed.

@claude claude / Claude Code Review

Static/File routes still emit lone empty Date/Content-Type — sibling serializer not fixed

Static and file routes serialize `FetchHeaders` through a separate path (`StaticRoute::do_write_headers` / `FileRoute` via `headers_jsc::from_fetch_headers` → `WebCore__FetchHeaders__copyTo`) that this PR doesn't touch, so `Bun.serve({ static: { '/': new Response('x', { headers: { date: '' } }) } })` still emits a lone empty `Date:` with the auto-Date suppressed — the exact bug the PR body describes. Same for `content-type: ''` (`fast_has_` is key-presence, so `needs_content_type` goes false and