|
|
|
@ -3,7 +3,6 @@ import email.message |
|
|
|
import functools |
|
|
|
import inspect |
|
|
|
import json |
|
|
|
import sys |
|
|
|
from contextlib import AsyncExitStack, asynccontextmanager |
|
|
|
from enum import Enum, IntEnum |
|
|
|
from typing import ( |
|
|
|
@ -79,11 +78,6 @@ from starlette.types import AppType, ASGIApp, Lifespan, Receive, Scope, Send |
|
|
|
from starlette.websockets import WebSocket |
|
|
|
from typing_extensions import Annotated, deprecated |
|
|
|
|
|
|
|
if sys.version_info >= (3, 13): # pragma: no cover |
|
|
|
from inspect import iscoroutinefunction |
|
|
|
else: # pragma: no cover |
|
|
|
from asyncio import iscoroutinefunction |
|
|
|
|
|
|
|
|
|
|
|
# Copy of starlette.routing.request_response modified to include the |
|
|
|
# dependencies' AsyncExitStack |
|
|
|
@ -308,7 +302,7 @@ def get_request_handler( |
|
|
|
embed_body_fields: bool = False, |
|
|
|
) -> Callable[[Request], Coroutine[Any, Any, Response]]: |
|
|
|
assert dependant.call is not None, "dependant.call must be a function" |
|
|
|
is_coroutine = iscoroutinefunction(dependant.call) |
|
|
|
is_coroutine = dependant.is_coroutine_callable |
|
|
|
is_body_form = body_field and isinstance( |
|
|
|
body_field.field_info, (params.Form, temp_pydantic_v1_params.Form) |
|
|
|
) |
|
|
|
|