Browse Source

fix none default

pull/13537/head
adhoc 2 weeks ago
parent
commit
a36c655c43
  1. 4
      fastapi/dependencies/utils.py

4
fastapi/dependencies/utils.py

@ -837,6 +837,7 @@ async def _extract_form_body(
values = {} values = {}
first_field = body_fields[0] first_field = body_fields[0]
first_field_info = first_field.field_info first_field_info = first_field.field_info
processed_keys = set()
for field in body_fields: for field in body_fields:
value = _get_multidict_value(field, received_body) value = _get_multidict_value(field, received_body)
@ -865,10 +866,11 @@ async def _extract_form_body(
for sub_value in value: for sub_value in value:
tg.start_soon(process_fn, sub_value.read) tg.start_soon(process_fn, sub_value.read)
value = serialize_sequence_value(field=field, value=results) value = serialize_sequence_value(field=field, value=results)
processed_keys.add(field.alias)
if value is not None: if value is not None:
values[field.alias] = value values[field.alias] = value
for key, value in received_body.items(): for key, value in received_body.items():
if key not in values: if key not in processed_keys:
values[key] = value values[key] = value
return values return values

Loading…
Cancel
Save