Skip to content

T-031: feat(router): add support for the QUERY HTTP method - #159

Open
fleet-panda[bot] wants to merge 3 commits into
9.xfrom
task/T-031
Open

fleet-panda[bot] wants to merge 3 commits into
9.xfrom
task/T-031

Conversation

@fleet-panda

@fleet-panda fleet-panda Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Builds on #140 by @DavideCarvalho

Goal

QUERY (RFC 10008) is a safe and idempotent HTTP method that carries the query in the request body. #140 adds router.query(), urlFor.query() and signedUrlFor.query(), in the same way as the other methods.

The pull request also makes the router fail a QUERY request with no valid Content-Type. The bodyparser makes that check (adonisjs/bodyparser#87), because it reads the Content-Type and the content. The router only matches routes. This pull request removes the check from the router, on top of the commits of the author.

Deployment requirements

  • Release @adonisjs/http-server as a minor after the merge. The docs wait for the release.

Acceptance criteria

  • router.query(), urlFor.query() and signedUrlFor.query() work as feat(router): add support for the QUERY HTTP method #140 gives, with its tests. The tests of the author in tests/router/router.spec.ts, tests/router/url_builder.spec.ts and tests/server.spec.ts pass.
  • The router does not check the Content-Type of a QUERY request. The new test "invoke router handler for QUERY requests without a Content-Type header" sends a QUERY request with no Content-Type. The handler runs, and the status is 200.
  • E_INVALID_QUERY_CONTENT_TYPE is not in src/errors.ts, and routeFinder does not import type-is. src/server/factories/route_finder.ts is the same as in the first commit of the author.

Checks: npm run lint, npm run typecheck and npm run quick:test (671 tests) pass.

Context changes

None.

Discovered work

None.

DavideCarvalho and others added 3 commits October 16, 2026 10:26
Adds a router.query() shorthand for defining routes that respond to
the QUERY HTTP method (draft-ietf-httpbis-safe-method-w-body), along
with urlFor.query() and signedUrlFor.query() builders for parity with
the other verb-specific helpers.

Node.js supports the QUERY method since llhttp shipped it, which is
included in every version covered by the engines range (>=24.0.0).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
RFC 10008 (section 2) requires servers to fail QUERY requests when the
Content-Type request header is missing, since the request content and
its media type together define the query. Section 2.1 recommends a 400
response for requests lacking media type information.

The route finder now raises E_INVALID_QUERY_CONTENT_TYPE (400) for a
matched QUERY route when the Content-Type header is missing or is not a
valid media type. The check runs before the route middleware (including
the bodyparser), so the request content is never read, and the error
flows through the app error handler like E_ROUTE_NOT_FOUND.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The router only matches routes. The bodyparser reads the Content-Type
and the content of a QUERY request, so it makes the check.
@fleet-panda

fleet-panda Bot commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

Triage: nothing to do. The only change is commit ae576b7 of the build, which removes the Content-Type check from the router as T-031 gives, and all checks pass with no review or comment to answer.

This branch has not been deployed

No deployments
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.

2 participants