Functions
handle_request
14
None
▼
Process a single HTTP request through the full pipeline.
async
handle_request
14
None
▼
async def handle_request(scope: Scope, receive: Receive, send: Send, *, router: Router, middleware: tuple[Callable[..., Any], ...], error_handlers: dict[int | type, Callable[..., Any]], kida_env: Environment | None = None, debug: bool, providers: dict[type, Callable[..., Any]] | None = None, tool_registry: ToolRegistry | None = None, mcp_path: str = '/mcp', sse_heartbeat_interval: float = 15.0, sse_retry_ms: int | None = None, sse_close_event: str | None = None) -> None
Parameters
| Name | Type | Description |
|---|---|---|
scope |
Scope |
|
receive |
Receive |
|
send |
Send |
|
router |
Router |
|
middleware |
tuple[Callable[..., Any], ...] |
|
error_handlers |
dict[int | type, Callable[..., Any]] |
|
kida_env |
Environment | None |
Default:None
|
debug |
bool |
|
providers |
dict[type, Callable[..., Any]] | None |
Default:None
|
tool_registry |
ToolRegistry | None |
Default:None
|
mcp_path |
str |
Default:'/mcp'
|
sse_heartbeat_interval |
float |
Default:15.0
|
sse_retry_ms |
int | None |
Default:None
|
sse_close_event |
str | None |
Default:None
|
_invoke_handler
4
AnyResponse
▼
Call the matched route handler, converting path params and return value.
async
_invoke_handler
4
AnyResponse
▼
async def _invoke_handler(match: RouteMatch, request: Request, *, kida_env: Environment | None = None, providers: dict[type, Callable[..., Any]] | None = None) -> AnyResponse
Parameters
| Name | Type | Description |
|---|---|---|
match |
RouteMatch |
|
request |
Request |
|
kida_env |
Environment | None |
Default:None
|
providers |
dict[type, Callable[..., Any]] | None |
Default:None
|
Returns
AnyResponse
_build_handler_kwargs
5
dict[str, Any]
▼
Inspect handler signature and build kwargs from request + path params.
Resolut…
_build_handler_kwargs
5
dict[str, Any]
▼
def _build_handler_kwargs(handler: Callable[..., Any], request: Request, path_params: dict[str, str], providers: dict[type, Callable[..., Any]] | None = None, *, body_data: dict[str, Any] | None = None) -> dict[str, Any]
Inspect handler signature and build kwargs from request + path params.
Resolution order:
requestparameter (by name orRequestannotation)- Path parameters (by name, with type conversion)
- Context cascade values (page routes only — handled in page_wrapper)
- Service providers (by type annotation via
app.provide()) - Typed extraction (dataclass annotation → query string or body)
Parameters
| Name | Type | Description |
|---|---|---|
handler |
Callable[..., Any] |
|
request |
Request |
|
path_params |
dict[str, str] |
|
providers |
dict[type, Callable[..., Any]] | None |
Default:None
|
body_data |
dict[str, Any] | None |
Default:None
|
Returns
dict[str, Any]
_read_body_if_needed
2
dict[str, Any] | None
▼
Pre-read form/JSON body if the handler has extractable dataclass params.
Only …
async
_read_body_if_needed
2
dict[str, Any] | None
▼
async def _read_body_if_needed(handler: Callable[..., Any], request: Request) -> dict[str, Any] | None
Pre-read form/JSON body if the handler has extractable dataclass params.
Only reads the body for non-GET methods. ReturnsNoneif no
extraction is needed or the method is GET/HEAD.
Parameters
| Name | Type | Description |
|---|---|---|
handler |
Callable[..., Any] |
|
request |
Request |
Returns
dict[str, Any] | None