pub async fn read_body(body: &mut Body) -> Result<Bytes, BoxError> {
    let mut acc = BytesMut::new();
    while let Some(result) = body.next().await {
        let chunk = result.map_err(Box::new)?;
        if acc.len() + chunk.len() > 8096 {
            return Err(Box::new(SizeLimitExceeded));
        }
        acc.extend(chunk);
    }
    Ok(acc.freeze())
}
/// Read the request or response body up to a fixed size.
Read the request or response body up to a fixed size.
Read the request or response body up to a fixed size .
pub async fn read_body(body: &mut Body) -> Result<Bytes, BoxError> {
    let mut acc = BytesMut::new();
    while let Some(result) = body.next().await {
        let chunk = result.map_err(Box::new)?;
        if acc.len() + chunk.len() > 8096 {
            return Err(Box::new(SizeLimitExceeded));
        }
        acc.extend(chunk);
    }
    Ok(acc.freeze())
}
pub async fn read_body ( body : & mut Body ) -> Result < Bytes , BoxError > { let mut acc = BytesMut :: new ( ) ; while let Some ( result ) = body . next ( ) . await { let chunk = result . map_err ( Box :: new ) ? ; if acc . len ( ) + chunk . len ( ) > 8096 { return Err ( Box :: new ( SizeLimitExceeded ) ) ; } acc . extend ( chunk ) ; } Ok ( acc . freeze ( ) ) }
Read the request or response body up to a fixed size.
Read the request or response body up to a fixed size .
body
&mut Body
body
&mut Body