Skip to content

fix: respond to HEAD requests without a body - #17036

Open
Nic-Polumeyv wants to merge 1 commit into
version-3from
head-no-body
Open

fix: respond to HEAD requests without a body#17036
Nic-Polumeyv wants to merge 1 commit into
version-3from
head-no-body

Conversation

@Nic-Polumeyv

@Nic-Polumeyv Nic-Polumeyv commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Server.respond returns HEAD responses with a body. The HTTP layer in front of it has always discarded that body, so nothing noticed until Server.respond was called directly.

It now cancels the body and returns a bodiless copy of the response, after the dev-only error lookup keyed on the original response object. Headers, including content-length, are kept.

@pkg-svelte-dev

pkg-svelte-dev Bot commented Sep 4, 2026

Copy link
Copy Markdown

Install the latest version of @sveltejs/kit from 11a48c9:

pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/11a48c940e37d5bb210d490a33ff9518b4034af1

Open in pkg.svelte.dev: https://pkg.svelte.dev/repos/kit/pr/17036

@changeset-bot

changeset-bot Bot commented Sep 4, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 11a48c9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/kit Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@svelte-docs-bot

Copy link
Copy Markdown

@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: QUIET

Plan: Advanced

Run ID: 77480584-46f5-4a0d-9b1f-be674fc5071d

📥 Commits

Reviewing files that changed from the base of the PR and between a2ba146 and 11a48c9.

📒 Files selected for processing (2)
  • .changeset/quiet-heads-rest.md
  • packages/kit/src/runtime/server/index.js
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • sveltejs/vite-plugin-svelte (manual)
  • vitejs/vite (manual)
  • sveltejs/svelte (manual)

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

Server.respond now removes response bodies from direct HEAD requests by cancelling the body and returning an equivalent response with a null body. HTTP-layer handling remains unchanged. A patch Changeset entry records the fix for @sveltejs/kit.

Merge Risk: ⚪ Minimal · up to 11a48

Direct HEAD callers now receive bodyless responses while retaining response headers such as content-length. No current merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Backward Compatibility Impact Disclosure ✅ Passed PASS — The pull request does not introduce any listed breaking interface change. The public Server.respond(request, options): Promise<Response> declaration is unchanged. The diff removes no exports,…
Title check ✅ Passed The title uses the required fix: prefix and accurately describes the change to return HEAD responses without a body.

Comment @coderabbitai help to get the list of available commands.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant