Skip to content

perf(request): fast-path QUERY methods#376

Merged
yusukebe merged 1 commit into
mainfrom
perf/query-method-fast-path
Jul 19, 2026
Merged

perf(request): fast-path QUERY methods#376
yusukebe merged 1 commit into
mainfrom
perf/query-method-fast-path

Conversation

@usualoma

Copy link
Copy Markdown
Member

Note

This is a very small optimization. It does not change behavior in any way.

Add QUERY to the fast path in normalizeIncomingMethod.

Node.js http.createServer() already supports receiving QUERY requests and exposing the method through req.method. Support was introduced in Node.js v22.2.0 via nodejs/node#52701 and later backported to Node.js v20.19.3.

This change avoids an unnecessary toUpperCase() call and makes the standardized method explicitly recognized by the normalization fast path.

QUERY is added only to the exact-uppercase fast path. Lowercase and mixed-case variants remain unchanged because HTTP method names are case-sensitive.

@usualoma

Copy link
Copy Markdown
Member Author

Hi @yusukebe,
Could you please leave a review?

@yusukebe yusukebe 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!

@yusukebe

Copy link
Copy Markdown
Member

@usualoma Thank you for the PR!

One thing I realized: PATCH is not listed as a method in the fast path. Is it worth adding it? Anyway, I'll merge this now.

@yusukebe
yusukebe merged commit 962baa4 into main Jul 19, 2026
5 checks passed
@yusukebe
yusukebe deleted the perf/query-method-fast-path branch July 19, 2026 23:46
@usualoma

Copy link
Copy Markdown
Member Author

@yusukebe
Ah, you're right. It definitely would be better to include the PATCH method on this list.

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