-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
web.FileResponse overrides content_type #2317
Comments
I'm inclined to opening a PR to resolve this issue, suggestions are highly appreciated. |
The only problem is figuring out if content type was explicitly set. Well, the following code should work:
|
Ok, I see the flaw behind this, nevermind. |
Fixed by #2319 |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a [new issue] for related bugs. |
Long story short
When returning a
web.FileResponse
from a route, any changes to thecontent_type
member is not taken into account when the file is served. Instead, the file extension is always used to determine the content type of the response.Expected behaviour
Content-Type
header of the response be that ofweb.FileResponse.content_type
when such has been set.Actual behaviour
Content-Type
header is guessed from the file extension of the served file.Steps to reproduce
Create a route that responds something along the lines of
then
curl -i
it and notice theContent-Type
isimage/png
.Your environment
The text was updated successfully, but these errors were encountered: