From a36c655c4393fd43b755f66f98d7c32ec5d3c896 Mon Sep 17 00:00:00 2001 From: adhoc Date: Tue, 25 Mar 2025 14:50:20 +0100 Subject: [PATCH] fix none default --- fastapi/dependencies/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fastapi/dependencies/utils.py b/fastapi/dependencies/utils.py index d205d17fa..43e74452b 100644 --- a/fastapi/dependencies/utils.py +++ b/fastapi/dependencies/utils.py @@ -837,6 +837,7 @@ async def _extract_form_body( values = {} first_field = body_fields[0] first_field_info = first_field.field_info + processed_keys = set() for field in body_fields: value = _get_multidict_value(field, received_body) @@ -865,10 +866,11 @@ async def _extract_form_body( for sub_value in value: tg.start_soon(process_fn, sub_value.read) value = serialize_sequence_value(field=field, value=results) + processed_keys.add(field.alias) if value is not None: values[field.alias] = value for key, value in received_body.items(): - if key not in values: + if key not in processed_keys: values[key] = value return values