Closed
Description
Long story short
When returning a web.FileResponse from a route, any changes to the content_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 of web.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
response = web.FileResponse('/path/to/some/image.png')
response.content_type = 'application/octet-stream'
return responsethen curl -i it and notice the Content-Type is image/png.
Your environment
[~]$ uname -mrs
Linux 4.11.9-1-ARCH x86_64
[~]$ python --version
Python 3.6.2
[~]$ pip show aiohttp | grep Version
Version: 2.2.5