Skip to content

feat: support the QUERY HTTP method in +server.js - #16782

Merged
Rich-Harris merged 4 commits into
sveltejs:version-3from
WolfieLeader:feat/query-method-server-export
Aug 13, 2026
Merged

feat: support the QUERY HTTP method in +server.js#16782
Rich-Harris merged 4 commits into
sveltejs:version-3from
WolfieLeader:feat/query-method-server-export

Conversation

@WolfieLeader

Copy link
Copy Markdown
Contributor

Add the new HTTP method

Adding the new QUERY method.

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

Edits

  • Please ensure that 'Allow edits from maintainers' is checked. PRs without this option may be closed.

RFC 10008 defines QUERY, a safe method that carries a request body.
A named `QUERY` export in `+server.js` was rejected by the server-export
allowlist, so the only way to answer a QUERY request was `fallback`.

Add QUERY to `valid_server_exports`, to `ENDPOINT_METHODS` so it is
routed to the endpoint regardless of the `accept` header and reported in
the `allow` header of a 405, and to the `HttpMethod` type.
@pkg-svelte-dev

pkg-svelte-dev Bot commented Aug 13, 2026

Copy link
Copy Markdown

Install the latest version of @sveltejs/kit from 4f0da83:

pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/4f0da8392545fbaadf8da36bde0043fbcfea4e4e

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

Note

This PR is from a fork. A maintainer must approve approve each commit before it can be built and installed.

@changeset-bot

changeset-bot Bot commented Aug 13, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4f0da83

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 Minor

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

@teemingc

Copy link
Copy Markdown
Member

I don’t know if this is something we want to add yet (or at all). You can always use https://svelte.dev/docs/kit/routing#server-Fallback-method-handler to support this

@WolfieLeader

Copy link
Copy Markdown
Contributor Author

@teemingc No worries man. Do you want me to fix a flaky test you had?

@teemingc

Copy link
Copy Markdown
Member

Do you want me to fix a flaky test you had?

Yes, we’d appreciate that. Which test are you talking about?

QUERY responses depend on the request body, so they can never be served
statically. Extend both prerender guards to match the mutative methods,
otherwise the handler builds silently and 404s in production.
BODY_DEPENDENT_METHODS is MUTATIVE_METHODS plus QUERY, which is excluded
from prerendering for a different reason: the response depends on the
request body. Extending ENDPOINT_METHODS without the hand-copied guard
lists is how the QUERY gap happened in the first place.
@WolfieLeader

Copy link
Copy Markdown
Contributor Author

I think the one that he fixed

@Rich-Harris Rich-Harris left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thank you!

@Rich-Harris
Rich-Harris merged commit a610618 into sveltejs:version-3 Aug 13, 2026
23 of 24 checks passed
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.

4 participants