Skip to content

exposeHeadRoutes option don't work as expected. #801

@luckyxhu

Description

@luckyxhu

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions