-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Labels
bugConfirmed bugConfirmed bug
Description
Prerequisites
- I have written a descriptive issue title
- I have searched existing issues to ensure the bug has not already been reported
Fastify version
4.0.3
Plugin version
No response
Node.js version
18
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
latest
Description
When the onRoute hook is registered after a GET handler, it is executed for the HEAD route only.
Steps to Reproduce
const fastify = require('fastify')
const app = fastify()
app.addHook('onRoute', function inspector(routeOptions) {
console.log('before ' + routeOptions.method)
})
app.get('/', function (request, reply) { })
app.addHook('onRoute', function inspector(routeOptions) {
console.log('after ' + routeOptions.method)
})
app.ready()
Prints:
before GET
before HEAD
after HEAD
Expected Behavior
I think the after hook should not be executed.
It should print:
before GET
before HEAD
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugConfirmed bugConfirmed bug