blackbull.asgi¶
blackbull.asgi
¶
ASGI protocol types: event-type string constants and typed event wrappers.
Two responsibilities, both framework-side:
ASGIEvent: namespace of ASGI 3.0 event-type strings, used formatch/casedispatch and equality checks across both the framework and (importing from here) the server stack.ResponseStart/ResponseBody: dict-subclass wrappers for the two outgoing response event shapes so middleware can dispatch on Python type rather than string comparison. Both subclassdictsoisinstance(e, dict)remains True — required for beartype and any ASGI send callable annotatedevent: dict.
ASGIEvent
¶
Namespace for ASGI protocol event type strings (ASGI 3.0 spec).
ResponseBody
¶
Bases: dict
http.response.body event with typed property access.
ResponseStart
¶
Bases: dict
http.response.start event with typed property access.
parse_response_event(event)
¶
Wrap event in the appropriate typed subclass for dispatch.
The returned object IS the event dict (shallow copy) — pass it directly to downstream send callables without re-serialisation. Trailers and unknown event types are returned unchanged.