YZY
2 days ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
3 additions and
2 deletions
-
fastapi/dependencies/utils.py
|
|
@ -717,7 +717,8 @@ def _get_multidict_value( |
|
|
|
field: ModelField, values: Mapping[str, Any], alias: Union[str, None] = None |
|
|
|
) -> Any: |
|
|
|
alias = alias or field.alias |
|
|
|
if is_sequence_field(field) and isinstance(values, (ImmutableMultiDict, Headers)): |
|
|
|
is_sequence = is_sequence_field(field) |
|
|
|
if is_sequence and isinstance(values, (ImmutableMultiDict, Headers)): |
|
|
|
value = values.getlist(alias) |
|
|
|
else: |
|
|
|
value = values.get(alias, None) |
|
|
@ -728,7 +729,7 @@ def _get_multidict_value( |
|
|
|
and isinstance(value, str) # For type checks |
|
|
|
and value == "" |
|
|
|
) |
|
|
|
or (is_sequence_field(field) and len(value) == 0) |
|
|
|
or (is_sequence and len(value) == 0) |
|
|
|
): |
|
|
|
if field.required: |
|
|
|
return |
|
|
|