Skip to content

response

Response §

Response(status_code=200, headers=None, body=b'', content_type='text/plain', charset='utf-8', streaming=False, streaming_body=None)

Tokamak Web framework response class

Parameters:

Name Type Description Default
status_code int

HTTP status code (default 200).

200
headers Optional[Dict[str, str]]

HTTP response headers.

None
body bytes

HTTP response body

b''
content_type str

Content-Type header value (default "text/plain")

'text/plain'
charset str

Character set for Content-Type value (default "utf-8")

'utf-8'
streaming bool

Whether to stream this response (for large payloads).

False
streaming_body Optional[Callable]

Optional Async iterator of bytes for streaming responses.

None

raw_headers property cached §

raw_headers()

Headers are constructed for an ASGI send response

Back to top