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

Plugin overwrites existing content-type header #480

Closed
2 tasks done
Fdawgs opened this issue Nov 11, 2024 · 1 comment · Fixed by #484
Closed
2 tasks done

Plugin overwrites existing content-type header #480

Fdawgs opened this issue Nov 11, 2024 · 1 comment · Fixed by #484

Comments

@Fdawgs
Copy link
Member

Fdawgs commented Nov 11, 2024

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.

@Fdawgs Fdawgs changed the title Plugin overwrites existing content-type and content-encoding headers Plugin overwrites existing content-type headers Nov 11, 2024
@Fdawgs Fdawgs changed the title Plugin overwrites existing content-type headers Plugin overwrites existing content-type header Nov 11, 2024
@mcollina
Copy link
Member

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

@Fdawgs Fdawgs linked a pull request Nov 22, 2024 that will close this issue
4 tasks
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

Successfully merging a pull request may close this issue.

2 participants