Module

server.sender

ASGI response sending — translates chirp Response types to ASGI messages.

Handles both standard single-body responses and chunked streaming responses.

Functions

_body_allowed 1 bool
Whether an HTTP status code permits a response body.
def _body_allowed(status: int) -> bool
Parameters
Name Type Description
status int
Returns
bool
send_response 2 None
Translate a chirp Response into ASGI send() calls.
async
async def send_response(response: Response, send: Send) -> None
Parameters
Name Type Description
response Response
send Send
send_streaming_response 3 None
Send a streaming response via chunked transfer encoding. Sends headers immedia…
async
async def send_streaming_response(response: StreamingResponse, send: Send, *, debug: bool = False) -> None

Send a streaming response via chunked transfer encoding.

Sends headers immediately, then each chunk as an ASGI body message withmore_body=True. Closes with an empty body. On mid-stream error, emits an HTML comment and closes.

Parameters
Name Type Description
response StreamingResponse
send Send
debug bool Default:False