fastify-swagger
fastify-swagger copied to clipboard
exposeHeadRoutes option don't work as expected.
Prerequisites
- [X] I have written a descriptive issue title
- [X] I have searched existing issues to ensure the bug has not already been reported
Fastify version
4.27.0
Plugin version
8.14.0
Node.js version
20.11.1
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
14.5
Description
await app.register(swagger, {
mode: 'dynamic',
openapi: config.get('openapi'),
exposeHeadRoutes: false
})
Even if exposeHeadRoutes is set to false, HEAD routes still exist in the specification.
I traced the code and found that it works correctly after modifying the following code in addHook() (lib/util/add-hook.js):
// routes.push(routeOptions)
routes.push({...routeOptions})
I'm not sure if there is a problem with modifying it like this, or if there is another better way?
Link to code that reproduces the bug
No response
Expected Behavior
No response
Thanks for reporting! Would you like to send a Pull Request to address this issue? Remember to add unit tests.