fix: allow callabe in dependant for get_request_handler

This commit is contained in:
reton2 2024-05-01 10:55:30 +01:00
parent a94ef3351e
commit f8074c72d9
1 changed files with 5 additions and 1 deletions

View File

@ -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