Skip to content

fix: scope autohooks setNotFoundHandler under prefixed autoload#497

Merged
mcollina merged 1 commit into
fastify:mainfrom
SergioChan:fix-issue-326-notfound-scope
Mar 8, 2026
Merged

fix: scope autohooks setNotFoundHandler under prefixed autoload#497
mcollina merged 1 commit into
fastify:mainfrom
SergioChan:fix-issue-326-notfound-scope

Conversation

@SergioChan
Copy link
Copy Markdown
Contributor

@SergioChan SergioChan commented Mar 8, 2026

Summary

  • scope autohooks registration under a shared plugin prefix when all plugins in the node resolve to the same prefix
  • strip that shared prefix from child plugin registrations inside the scoped context so routes are not double-prefixed
  • add a regression test for issue setNotFoundHandler is not encapsulated when called inside autohooks.js #326 proving setNotFoundHandler from autohooks.js only affects /api/* requests

Testing

  • npm run unit test/issues/326/test.js test/issues/374/test.js test/issues/376/test.js test/issues/453/test.js

Related

Fixes #326

Copy link
Copy Markdown
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@mcollina mcollina merged commit b5cef0d into fastify:main Mar 8, 2026
16 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.

setNotFoundHandler is not encapsulated when called inside autohooks.js

3 participants