﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
34404	Incorrect documentation about content type set by FileResponse object	chamalsl	Ayush Bisht	"Below is an excerpt from the Django document for FileResponse object.
Link: [https://docs.djangoproject.com/en/4.1/ref/request-response/]

 ""The Content-Length and Content-Type headers are automatically set when they can be guessed from contents of open_file"".

But code inside FileResponse object does not use contents of open_file to guess content type.
It uses ""mimetypes.guess_type()"" method to determine content type.
""mimetypes.guess_type()"" method uses file extension to to determine content type.

So a file response object such as this will set the content type to ""text/html"".
  
{{{
FileResponse(open('test.gif', 'rb'), filename=""test.html"")
}}}


Documentation should correctly mention how FileResponse object determine content type."	Cleanup/optimization	closed	Documentation	4.1	Normal	fixed		chamalsl	Ready for checkin	1	0	0	0	1	0
