Skip to main content

partial_bytes_response

Function partial_bytes_response 

Source
pub fn partial_bytes_response(
    resolution: &RangeResolution,
    full: Bytes,
) -> Response<Body>
Expand description

Build the in-memory response for a resolved range over full bytes.

  • Full200 OK, the whole body, Accept-Ranges: bytes, Content-Length = full.len().
  • Partial206 Partial Content, the sliced body, Accept-Ranges: bytes, Content-Range: bytes start-end/total, Content-Length = slice length.
  • Unsatisfiable416 Range Not Satisfiable, empty body, Content-Range: bytes */total.

The caller layers Content-Type / Content-Disposition on top.