Skip to content

feat(http/unstable): accept HeadersInit for serveDir and serveFile headers#7190

Open
minato32 wants to merge 1 commit into
denoland:mainfrom
minato32:feat/6723-headersinit
Open

feat(http/unstable): accept HeadersInit for serveDir and serveFile headers#7190
minato32 wants to merge 1 commit into
denoland:mainfrom
minato32:feat/6723-headersinit

Conversation

@minato32

Copy link
Copy Markdown

Closes #6723.

ServeDirOptions.headers and ServeFileOptions.headers in @std/http/unstable-file-server now accept HeadersInit instead of string[], so callers can pass a Headers instance, a record, or a list of tuples without hand-rolling name:value strings.

The stable serveDir/serveFile keep their existing string[] signature, so the file-server CLI behaviour is unchanged. The unstable wrapper strips headers before delegating to the stable implementation and applies them to the response itself (skipping redirect responses, matching the stable behaviour).

@CLAassistant

CLAassistant commented Jun 24, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@codecov

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.44444% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 94.56%. Comparing base (cdf74a8) to head (2599d13).

Files with missing lines Patch % Lines
http/unstable_file_server.ts 94.44% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7190      +/-   ##
==========================================
- Coverage   94.57%   94.56%   -0.01%     
==========================================
  Files         636      637       +1     
  Lines       52142    52158      +16     
  Branches     9401     9404       +3     
==========================================
+ Hits        49315    49325      +10     
- Misses       2249     2254       +5     
- Partials      578      579       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

suggestion(http): change ServeDirOptions.headers to accept HeadersInit instead of string[]

2 participants