serialize_streaming_response
def serialize_streaming_response[B: Body](var resp: StreamingResponse[B], cancel: Cancel, keep_alive: Bool = True) -> List[UInt8] Render resp to wire bytes — status line + headers + body (Content-Length or chunked framing).
- Args
resp: Streaming response with aBodyimpl. Ownership transferred; the body is consumed chunk by chunk.cancel: Per-request cancel token. The body'snext_chunk(cancel)polls this; flipping it mid-stream stops chunk emission cleanly (chunked framing's terminator is still written so the framing contract holds).keep_alive: WhenTrue, the response carriesConnection: keep-alive; whenFalse,Connection: close. The reactor sets this based on the request's connection disposition.
Raises Error: Any error from body.next_chunk propagates.