Skip to main content

streaming_response

Function streaming_response 

Source
pub fn streaming_response<S, E>(
    status: StatusCode,
    content_type: impl Into<String>,
    stream: S,
) -> HttpResponse
where S: Stream<Item = Result<Bytes, E>> + 'static, E: Error + 'static,
Expand description

Builds a chunked response whose stream items are explicit flush opportunities.

Actix forwards each yielded Bytes value as a body chunk. The anti-buffering headers keep common reverse proxies from coalescing those chunks indefinitely.