Skip to content

fix: normalize method in findRoute - #6838

Merged
climba03003 merged 1 commit into
fastify:mainfrom
Ram-blip:fix-findroute-method-normalization
Jul 11, 2026
Merged

fix: normalize method in findRoute#6838
climba03003 merged 1 commit into
fastify:mainfrom
Ram-blip:fix-findroute-method-normalization

Conversation

@Ram-blip

@Ram-blip Ram-blip commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Description

findRoute() was passing the provided method directly to the router lookup. Because registered route methods are normalized, a lookup like findRoute({ method: 'get', ... }) returned null even when the matching GET route existed.

This change normalizes the method in findRoute(), matching the existing behavior in hasRoute().

Changes proposed:

  • Updated lib/route.js to normalize the method before calling router.find()
  • Added a regression test in test/find-route.test.js for lowercase method lookup

Verification

  1. Ran node --test test/find-route.test.js
  2. Ran node --test test/has-route.test.js
  3. Ran npm test

Checklist

climba03003
climba03003 previously approved these changes Jul 8, 2026
@Ram-blip
Ram-blip force-pushed the fix-findroute-method-normalization branch from 6834bb1 to 37e41ea Compare July 8, 2026 16:09
@Ram-blip
Ram-blip requested a review from climba03003 July 8, 2026 16:11
@climba03003
climba03003 requested a review from a team July 11, 2026 12:56
@climba03003
climba03003 merged commit 6682c4f into fastify:main Jul 11, 2026
36 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.

3 participants