Skip to content

feat: rfc10008 http query method - #6832

Merged
mcollina merged 1 commit into
mainfrom
rfc-10008
Jul 16, 2026
Merged

mcollina merged 1 commit into
mainfrom
rfc-10008

Conversation

@climba03003

@climba03003 climba03003 commented Jul 4, 2026 •

Copy link
Copy Markdown
Member

Fixes #6807

@kalvenschraut Do point out a valid view about the "Proposed Standard" on RFC

I have look though the history of RFC10008 and it takes about 11 years (2015 - 2026 Jun) to the current state.
It should receive good amount of reviews and good to use.

Checklist

@github-actions github-actions Bot added documentation Improvements or additions to documentation typescript TypeScript related labels Jul 4, 2026
Comment thread lib/errors.js Resolved
@climba03003

Copy link
Copy Markdown
Member Author

Some question on my mind,

  1. Should we support auto Accept-Query header return?

Example 1
Provides though route option.

fastify.query('/query', { acceptQuery: 'application/json' }, () => 'foo')

Example 2
Automatically return by the supported parser list.

Example 3
Combined both Example 1 and Example 2 (use as fallback)

  1. Should we support Location or Content-Location?

It means that we should support some caching mechanism, or a standardize interface.

fastify.query('/query', {
  query: {
    locationPrefix: '/queries',
    contentLocationPrefix: '/results',
    saveQuery: (body) => id,
    retrieveQuery: (id) => body,
    saveResult: (body) => id,
    retrieveResult: (id) => body,
  }
}, () => 'foo')

We can provides this feature though plugin.

@Eomm
Eomm self-requested a review July 5, 2026 09:21
Eomm
Eomm previously approved these changes Jul 5, 2026
mcollina
mcollina previously approved these changes Jul 5, 2026

@mcollina mcollina 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.

lgtm

@climba03003
climba03003 dismissed stale reviews from mcollina and Eomm via 0966d2f July 6, 2026 15:46
@climba03003
climba03003 requested review from Eomm and mcollina July 6, 2026 15:49
@climba03003

Copy link
Copy Markdown
Member Author

Rebased to resolve conflict.

@mcollina mcollina 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.

lgtm

@mcollina
mcollina enabled auto-merge (squash) July 11, 2026 23:05
@climba03003
climba03003 requested a review from a team July 13, 2026 20:12

@jsumners jsumners 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.

I think this is a fair minimal approach, but it does not fully implement the spec as written.

Comment thread lib/handle-request.js Resolved
Comment thread lib/handle-request.js Resolved
Comment thread lib/handle-request.js Resolved
@mcollina
mcollina merged commit 6e680c3 into main Jul 16, 2026
42 checks passed
@mcollina
mcollina deleted the rfc-10008 branch July 16, 2026 09:17
tzafrirben pushed a commit to tzafrirben/light-my-request that referenced this pull request Jul 18, 2026
QUERY is now a standardized HTTP method per RFC 10008, and fastify
added it to their own method types in fastify/fastify#6832. Add it
as an explicit literal so it gets IDE autocomplete, alongside a type
test proving arbitrary custom methods (e.g. REBIND) still work via
the (string & {}) fallback.
BridgeAR added a commit to DataDog/dd-trace-js that referenced this pull request Aug 10, 2026
Fastify 5.11 adds QUERY to the methods registered by app.all(), so endpoint collection returns one more route than older versions.

Refs: fastify/fastify#6832
BridgeAR added a commit to DataDog/dd-trace-js that referenced this pull request Aug 10, 2026
Fastify 5.11 adds QUERY to the methods registered by app.all(), so endpoint collection returns one more route than older versions.

Refs: fastify/fastify#6832
pabloerhard pushed a commit to DataDog/dd-trace-js that referenced this pull request Aug 17, 2026
Fastify 5.11 adds QUERY to the methods registered by app.all(), so endpoint collection returns one more route than older versions.

Refs: fastify/fastify#6832
pabloerhard pushed a commit to DataDog/dd-trace-js that referenced this pull request Aug 17, 2026
Fastify 5.11 adds QUERY to the methods registered by app.all(), so endpoint collection returns one more route than older versions.

Refs: fastify/fastify#6832
Puppo added a commit to Puppo/fastify that referenced this pull request Sep 1, 2026
PR fastify#6832 added the QUERY HTTP method and the fastify.query() route
shorthand, but Routes.md was not updated alongside the Server.md and
Errors.md changes.

- List QUERY in the supported methods for the route  option.
- Add QUERY to the methods for which the  schema is validated.
- Add the fastify.query() entry in the Shorthand declaration list.
- Note the Content-Type requirement (400 FST_ERR_ROUTE_MISSING_CONTENT_TYPE).
mcollina pushed a commit that referenced this pull request Oct 10, 2026
## Why

PR [#6832](#6832) introduced the
QUERY HTTP method (RFC 10008) and the `fastify.query()` route shorthand.
`docs/Reference/Server.md` and `docs/Reference/Errors.md` were updated
as part of that PR, but `docs/Reference/Routes.md` was not — leaving
users without a doc entry for the new shorthand and a stale list of
supported methods.

## What

Four edits to `docs/Reference/Routes.md`:

1. Add `QUERY` to the methods listed for the `method` route option.
2. Add `QUERY` to the methods for which the `body` schema is validated.
3. Add the `fastify.query(path, [options], handler)` shorthand entry
after `fastify.patch`.
4. Note that QUERY (RFC 10008) requires a `Content-Type` header

## Verification

`npx markdownlint-cli2 docs/Reference/Routes.md` — no errors.

Co-authored-by: Antonio Tripodi <[email protected]>
@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Nov 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

documentation Improvements or additions to documentation typescript TypeScript related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: support HTTP QUERY method (RFC 10008)

6 participants