Function response_from_bytes

Source
pub fn response_from_bytes<BodyT>(
    body: Bytes,
    content_type: &str,
    headers: HeaderMap,
) -> Result<Response<BodyT>, StatusCode>
where BodyT: From<Bytes>,
Expand description

Creates a response with a Bytes body.

The Content-Type and Content-Length headers will be set, overriding existing values.

The response body must implement From<Bytes>.