Skip to main content

encode

Function encode 

Source
pub async fn encode(
    headers: &mut HeaderMap,
    body: &[u8],
    coding: Coding,
) -> Result<Vec<u8>>
Expand description

Compress a request body in coding, and declare it in the headers.

Returns the bytes that go on the wire, with Content-Encoding naming coding after whatever the caller had already declared, and Content-Length removed: it described the body before compression. The two cannot disagree about what the body carries.

compress_buffer and ContentEncoding::layer are the halves, for a caller driving them separately.