Skip to content

fix(http): handle HEAD requests in serveDir#7024

Merged
kt3k merged 2 commits intodenoland:mainfrom
wilkmaciej:feat/http-head-serveDir
Mar 14, 2026
Merged

fix(http): handle HEAD requests in serveDir#7024
kt3k merged 2 commits intodenoland:mainfrom
wilkmaciej:feat/http-head-serveDir

Conversation

@wilkmaciej
Copy link
Copy Markdown
Contributor

Summary

  • serveDir() now accepts HEAD requests alongside GET, resolving the inconsistency where serveFile() already supported HEAD but serveDir() returned 405
  • serveDirIndex() returns a bodiless response with correct Content-Length for HEAD requests on directory listings

Closes #6750
Supersedes #6752

@wilkmaciej wilkmaciej requested a review from kt3k as a code owner February 23, 2026 23:29
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Feb 23, 2026

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added the http label Feb 23, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.02%. Comparing base (4221795) to head (bd97d53).
⚠️ Report is 20 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7024      +/-   ##
==========================================
+ Coverage   93.73%   94.02%   +0.28%     
==========================================
  Files         620      627       +7     
  Lines       49388    50034     +646     
  Branches     8651     8809     +158     
==========================================
+ Hits        46293    47042     +749     
+ Misses       3025     2413     -612     
- Partials       70      579     +509     

☔ View full report in Codecov by Sentry.
📢 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.

@kt3k kt3k changed the title feat(http): handle HEAD requests in serveDir fix(http): handle HEAD requests in serveDir Mar 6, 2026
kt3k
kt3k previously approved these changes Mar 6, 2026
Copy link
Copy Markdown
Contributor

@kt3k kt3k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Nice! Thanks

Comment thread http/file_server.ts Outdated
@kt3k kt3k dismissed their stale review March 6, 2026 06:19

retract

@kt3k
Copy link
Copy Markdown
Contributor

kt3k commented Mar 6, 2026

Thanks for the PR. Left one comment

Copy link
Copy Markdown
Contributor

@kt3k kt3k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kt3k kt3k merged commit a60280d into denoland:main Mar 14, 2026
19 checks passed
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.

Allow HEAD mathod in file-server

3 participants