Skip to content

Plugin overwrites existing content-type header #480

@Fdawgs

Description

@Fdawgs

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Fastify version

5.1.0

Plugin version

8.0.2

Node.js version

20.18.0

Operating system

Windows

Operating system version (i.e. 20.04, 11.3, 10)

11

Description

v8.x does not respect existing content-type headers when serving files and overwrites them here using headers returned by a @fastify/send call. This was not the case in previous versions of the plugin.

Spotted this as I set the content-type of a static file using reply.type() here, and it's overwriting it.

Link to code that reproduces the bug

No response

Expected Behavior

For the plugin to check if content-type is already set, and use it if so.

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