From: Sebastián Ramírez Date: Sat, 22 Dec 2018 05:05:13 +0000 (+0400) Subject: :rotating_light: Fix mypy type errors X-Git-Tag: 0.1.13~18 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=75407b92952d4a5fabe9b2d7084fddce5725dcbd;p=thirdparty%2Ffastapi%2Ffastapi.git :rotating_light: Fix mypy type errors --- diff --git a/fastapi/routing.py b/fastapi/routing.py index 964d61ee70..0045f3a794 100644 --- a/fastapi/routing.py +++ b/fastapi/routing.py @@ -53,14 +53,14 @@ def get_app( if body_field: if is_body_form: raw_body = await request.form() - body = {} + form_fields = {} for field, value in raw_body.items(): if isinstance(value, UploadFile): - body[field] = await value.read() + form_fields[field] = await value.read() else: - body[field] = value - if not body: - body = None + form_fields[field] = value + if form_fields: + body = form_fields else: body_bytes = await request.body() if body_bytes: