diff options
| author | Ayush Bisht <bisht.ayush2001@gmail.com> | 2023-03-11 22:43:31 +0530 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-03-16 08:31:23 +0100 |
| commit | eff2ba3f8d2f172c64b9df08db8d188e11bae855 (patch) | |
| tree | fb4ec5c363fc5e2063bde399f8e93f3f32b180d3 | |
| parent | 69a3890c2aca02cf5563a663696ba219dce34e8b (diff) | |
[4.2.x] Fixed #34404 -- Clarified how FileResponse set Content-Type header.
Backport of fc266b694b9129e44b597d8a56927ee13fdac358 from main
| -rw-r--r-- | docs/ref/request-response.txt | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/docs/ref/request-response.txt b/docs/ref/request-response.txt index 3103c9ba63..2c195b6f90 100644 --- a/docs/ref/request-response.txt +++ b/docs/ref/request-response.txt @@ -1294,8 +1294,11 @@ Attributes Note that if you pass a file-like object like ``io.BytesIO``, it's your task to ``seek()`` it before passing it to ``FileResponse``. - The ``Content-Length`` and ``Content-Type`` headers are automatically set - when they can be guessed from contents of ``open_file``. + The ``Content-Length`` header is automatically set when it can be guessed + 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 a file open in binary mode like so: |
