Module

_internal.asgi

Typed ASGI definitions.

Replaces the standard Scope = MutableMapping[str, Any] with typed dataclasses for internal use. Users never see these.

Classes

HTTPScope 12
Typed HTTP scope parsed from raw ASGI scope dict. Internal only -- users interact with Request, no…

Typed HTTP scope parsed from raw ASGI scope dict.

Internal only -- users interact with Request, not this.

Attributes

Name Type Description
type str
asgi dict[str, str]
http_version str
method str
path str
raw_path bytes
query_string bytes
root_path str
headers tuple[tuple[bytes, bytes], ...]
server tuple[str, int] | None
client tuple[str, int] | None

Methods

from_scope 1 HTTPScope
Parse raw ASGI scope into typed object.
classmethod
def from_scope(cls, scope: Scope) -> HTTPScope
Parameters
Name Type Description
scope
Returns
HTTPScope