From 430e7c8efee1b5d5eff2ee399d9deb129496441d Mon Sep 17 00:00:00 2001 From: merlinz01 Date: Thu, 5 Sep 2024 21:35:50 -0400 Subject: [PATCH] fix lint errors Signed-off-by: merlinz01 --- fastapi/dependencies/utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fastapi/dependencies/utils.py b/fastapi/dependencies/utils.py index 6d4ba84a1..a00888751 100644 --- a/fastapi/dependencies/utils.py +++ b/fastapi/dependencies/utils.py @@ -811,7 +811,7 @@ async def _extract_form_body( async def request_body_to_args( body_fields: List[ModelField], - received_body: Optional[Union[Dict[str, Any], FormData]], + received_body: Optional[Union[Dict[str, Any], FormData, UndefinedType]], embed_body_fields: bool, ) -> Tuple[Dict[str, Any], List[Dict[str, Any]]]: values: Dict[str, Any] = {} @@ -838,7 +838,9 @@ async def request_body_to_args( for field in body_fields: loc = ("body", field.alias) value: Any = Undefined - if body_to_process is not None: + if body_to_process is not None and not isinstance( + body_to_process, UndefinedType + ): try: value = body_to_process.get(field.alias, Undefined) # If the received body is a list, not a dict