Request
The request a handler is answering. Valid during the handler call only: a read after the call raises RuntimeError.
body (property)
The raw request bytes.
client_ip (property)
The peer's socket address.
method (property)
The HTTP verb ('GET', 'POST', ...).
param_count (property)
The number of path captures on the matched route.
path (property)
The decoded path, without the query string.
should_stop (property)
True once the connection closed or the server is stopping; a long handler checks it to finish early.
__init__
__init__(self, /, *args, **kwargs)
Initialize self. See help(type(self)) for accurate signature.
attr
attrattr(self, name: str) -> str | None
attr(self, name: str) -> str | None
attr(name) -> str | None
An attribute set by set_attr.
cookie
cookiecookie(self, name: str) -> str | None
cookie(self, name: str) -> str | None
cookie(name) -> str | None
A cookie from the Cookie header.
cookies
cookiescookies(self) -> dict
cookies(self) -> dict
cookies() -> dict[str, str]
Every cookie of the Cookie header, the first value winning for a repeated name; the reading cookie(name) answers by name.
form_field
form_fieldform_field(self, name: str) -> str | None
form_field(self, name: str) -> str | None
form_field(name) -> str | None
A text field of a form body (multipart or urlencoded).
form_file
form_fileform_file(self, name: str) -> clika_runtime._core.http.FormFile | None
form_file(self, name: str) -> clika_runtime._core.http.FormFile | None
form_file(name) -> FormFile | None
An uploaded file of a multipart body.
form_parts
form_partsform_parts(self) -> list[clika_runtime._core.http.FormPart]
form_parts(self) -> list[clika_runtime._core.http.FormPart]
form_parts() -> list[FormPart]
Every part of a multipart body, repeated names kept; empty when the body is not multipart.
header
headerheader(self, name: str) -> str | None
header(self, name: str) -> str | None
header(name) -> str | None
The first value of a header, matched without regard to case.
param
paramparam(self, key: object) -> str
param(self, key: object) -> str
param(key) -> str
A path capture of a pattern route, by 0-based position (int) or by the name of a named group (str). IndexError / KeyError when the route has no such capture.
query
queryquery(self, name: str) -> str | None
query(self, name: str) -> str | None
query(name) -> str | None
The first value of a query parameter.
query_all
query_allquery_all(self, name: str) -> list[str]
query_all(self, name: str) -> list[str]
query_all(name) -> list[str]
Every value of a query parameter.
set_attr
set_attrset_attr(self, name: str, value: str) -> None
set_attr(self, name: str, value: str) -> None
set_attr(name, value) -> None
Attach a per-request attribute, the channel from a middleware to the handler.