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