debug_toolbar.litestar.middleware

Debug toolbar middleware for Litestar.

Classes

DebugToolbarMiddleware(app[, config, toolbar])

Litestar middleware for the debug toolbar.

ResponseState([started, body_chunks, ...])

Tracks response state during middleware processing.

class debug_toolbar.litestar.middleware.ResponseState(started=False, body_chunks=<factory>, headers=<factory>, status_code=200, is_html=False, headers_sent=False, original_headers=<factory>)[source]

Tracks response state during middleware processing.

started: bool = False
body_chunks: list[bytes]
headers: dict[str, str]
status_code: int = 200
is_html: bool = False
headers_sent: bool = False
original_headers: list[tuple[bytes, bytes]]
__init__(started=False, body_chunks=<factory>, headers=<factory>, status_code=200, is_html=False, headers_sent=False, original_headers=<factory>)
class debug_toolbar.litestar.middleware.DebugToolbarMiddleware(app, config=None, toolbar=None)[source]

Litestar middleware for the debug toolbar.

This middleware: - Initializes the request context for each request - Collects request/response metadata - Injects the toolbar HTML into responses - Adds Server-Timing headers

scopes: Scopes = {'http', 'websocket'}
exclude: str | list[str] | None = ['_debug_toolbar']
__init__(app, config=None, toolbar=None)[source]

Initialize the middleware.

Parameters: