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
Open
Bun.serve: treat empty header values as absent so auto Content-Type/Date are not duplicated#35336robobun wants to merge 7 commits into
robobun wants to merge 7 commits into
Claude / Claude Code Review
completed
Jul 24, 2026 in 12m 39s
Code review found 2 potential issues
Found 5 candidates, confirmed 2. See review comments for details.
Details
| Severity | Count |
|---|---|
| 🔴 Important | 0 |
| 🟡 Nit | 2 |
| 🟣 Pre-existing | 0 |
| Severity | File:Line | Issue |
|---|---|---|
| 🟡 Nit | src/runtime/server/StaticRoute.rs:496-499 |
Static/file route empty-header handling still diverges from dynamic path |
| 🟡 Nit | test/js/bun/http/bun-serve-headers.test.ts:82-106 |
rawHead / rawHeadStatic are near-duplicates |
Annotations
Check warning on line 499 in src/runtime/server/StaticRoute.rs
claude / Claude Code Review
Static/file route empty-header handling still diverges from dynamic path
The follow-up commit's `value.length == 0` skip in `StaticRoute::do_write_headers` / `FileRoute::write_headers` applies to *every* snapshot entry, but `WebCore__FetchHeaders__copyTo` flattens common and uncommon headers together — so a static/file route now drops `x-custom: ""` entirely while the dynamic path still emits it (contradicting the PR's "Uncommon (custom) headers are left untouched" and its test, which only covers the dynamic path). Separately, `from_fetch_headers` (headers_jsc.rs:42)
Check warning on line 106 in test/js/bun/http/bun-serve-headers.test.ts
claude / Claude Code Review
rawHead / rawHeadStatic are near-duplicates
`rawHead` (lines 12-33) and `rawHeadStatic` (lines 82-106) are byte-for-byte identical from `net.connect(...)` through `return raw.split(...)` — only the `Bun.serve` options differ. Per REVIEW.md's "the second time a multi-line block appears in your diff, extract a named helper", factor the ~15 lines of socket plumbing into one helper (e.g. `rawHeadFrom(server)` or `rawHead(serveOptions)`) and call it from both.
Loading