Skip to main content

bytes_response

Function bytes_response 

Source
pub fn bytes_response(
    status: StatusCode,
    content_type: &'static str,
    body: Bytes,
) -> Response
Expand description

Builds a response from a pre-serialized body and an explicit content type.

Useful for serving content that is generated once and cached, such as the OpenAPI document or a static documentation asset.