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

Set detected Content-Type only when not already set #96

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rtribotte
Copy link

This PR introduce a condition to set the Content-Type header, backed by a new test.

The goal is to have the identical behavior as the http/server and http/fs does.

Content-Type header will only be set with the detected MIME type if it is not already set, which means no header previously set (at all).
So the condition to set the header is when there is no existing key for the Content-Type header in the response writer map.

The purpose of handling the nil value could be seen as the capacity to disable content type detection, and at the same time, not having the Content-Type header in the resulting response for the client.

klauspost added a commit to klauspost/compress that referenced this pull request May 31, 2021
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 this pull request may close these issues.

None yet

1 participant