Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exposeHeadRoutes option don't work as expected. #801

Open
2 tasks done
luckyxhu opened this issue May 27, 2024 · 1 comment
Open
2 tasks done

exposeHeadRoutes option don't work as expected. #801

luckyxhu opened this issue May 27, 2024 · 1 comment

Comments

@luckyxhu
Copy link

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.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

@mcollina
Copy link
Member

mcollina commented Jun 9, 2024

Thanks for reporting! Would you like to send a Pull Request to address this issue? Remember to add unit tests.

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

No branches or pull requests

2 participants