mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
Fixed #34404 -- Clarified how FileResponse set Content-Type header.
This commit is contained in:
parent
78da5ca0c1
commit
fc266b694b
@ -1303,8 +1303,11 @@ Attributes
|
|||||||
Note that if you pass a file-like object like ``io.BytesIO``, it's your
|
Note that if you pass a file-like object like ``io.BytesIO``, it's your
|
||||||
task to ``seek()`` it before passing it to ``FileResponse``.
|
task to ``seek()`` it before passing it to ``FileResponse``.
|
||||||
|
|
||||||
The ``Content-Length`` and ``Content-Type`` headers are automatically set
|
The ``Content-Length`` header is automatically set when it can be guessed
|
||||||
when they can be guessed from contents of ``open_file``.
|
from the content of ``open_file``.
|
||||||
|
|
||||||
|
The ``Content-Type`` header is automatically set when it can be guessed
|
||||||
|
from the ``filename``, or the name of ``open_file``.
|
||||||
|
|
||||||
``FileResponse`` accepts any file-like object with binary content, for example
|
``FileResponse`` accepts any file-like object with binary content, for example
|
||||||
a file open in binary mode like so:
|
a file open in binary mode like so:
|
||||||
|
Loading…
Reference in New Issue
Block a user