From 337ae243b10d3c20db53b77bc3c7718bb4f1a164 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Pito=C5=84?= Date: Wed, 8 Feb 2023 06:20:19 +0100 Subject: [PATCH] Document that UploadFile's `filename` and `content_type` can be `None` (#2029) --- docs/requests.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/requests.md b/docs/requests.md index 10a180bb2..727d45bc8 100644 --- a/docs/requests.md +++ b/docs/requests.md @@ -119,8 +119,8 @@ multidict, containing both file uploads and text input. File upload items are re `UploadFile` has the following attributes: -* `filename`: A `str` with the original file name that was uploaded (e.g. `myimage.jpg`). -* `content_type`: A `str` with the content type (MIME type / media type) (e.g. `image/jpeg`). +* `filename`: An `str` with the original file name that was uploaded or `None` if its not available (e.g. `myimage.jpg`). +* `content_type`: An `str` with the content type (MIME type / media type) or `None` if it's not available (e.g. `image/jpeg`). * `file`: A `SpooledTemporaryFile` (a file-like object). This is the actual Python file that you can pass directly to other functions or libraries that expect a "file-like" object. * `headers`: A `Headers` object. Often this will only be the `Content-Type` header, but if additional headers were included in the multipart field they will be included here. Note that these headers have no relationship with the headers in `Request.headers`. * `size`: An `int` with uploaded file's size in bytes. This value is calculated from request's contents, making it better choice to find uploaded file's size than `Content-Length` header. `None` if not set.