diff --git a/fastapi/routing.py b/fastapi/routing.py index 6dd7d0fe4b..188ad22d3d 100644 --- a/fastapi/routing.py +++ b/fastapi/routing.py @@ -211,7 +211,7 @@ def get_request_handler( is_coroutine = ( asyncio.iscoroutinefunction(dependant.call) or callable(dependant.call) - and hasattr(dependant.call, "__call__") + and callable(dependant.call) and inspect.iscoroutinefunction(dependant.call.__call__) ) is_body_form = body_field and isinstance(body_field.field_info, params.Form)