-
Notifications
You must be signed in to change notification settings - Fork 887
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
Don't incorrectly default charset on FileResponse #1251
Conversation
By passing the content_type into the constructor to Response, we can allow it to decide intelligently whether the default charset should apply. Otherwise we'd have to replicate that logic somehow, or live with weird charset annotations on images, pdfs, and zips.
I'm not sure on the rationale behind adding this as a function versus just moving the lines up a bit and passing the options into |
I think my mind was affected by java where you cannot have any code before the super call. Sorry about that. I'll clean it up and add a unit test sometime. |
OK I made the changes you requested, please let me know if there's anything more to do. |
👍 LGTM. |
Great stuff, I fixed up some line endings and a resource warning. Thanks for the PR! |
I've updated the changelog and forward-ported this onto master as well. |
By passing the content_type into the constructor to Response, we can allow it to decide intelligently whether the default charset should apply. Otherwise we'd have to replicate that logic somehow, or live with weird charset annotations on images, pdfs, and zips.