Skip to main content

read_body_limited

Function read_body_limited 

Source
pub async fn read_body_limited(
    response: Response,
    limit: usize,
) -> Result<Vec<u8>, BodyReadError>
Expand description

Read the whole body, failing with BodyReadError::TooLarge when it is larger than limit bytes.

ยงErrors

Returns BodyReadError::TooLarge when the body exceeds limit, and BodyReadError::Transport when reading a chunk fails.