Browse Source

fix: allow callabe in dependant for get_request_handler

pull/11508/head
reton2 11 months ago
parent
commit
f8074c72d9
  1. 6
      fastapi/routing.py

6
fastapi/routing.py

@ -208,7 +208,11 @@ def get_request_handler(
dependency_overrides_provider: Optional[Any] = None,
) -> Callable[[Request], Coroutine[Any, Any, Response]]:
assert dependant.call is not None, "dependant.call must be a function"
is_coroutine = asyncio.iscoroutinefunction(dependant.call)
is_coroutine = (
asyncio.iscoroutinefunction(dependant.call)
or callable(dependant.call)
and inspect.iscoroutinefunction(dependant.call.__call__)
)
is_body_form = body_field and isinstance(body_field.field_info, params.Form)
if isinstance(response_class, DefaultPlaceholder):
actual_response_class: Type[Response] = response_class.value

Loading…
Cancel
Save