Function jsonrpsee_core::http_helpers::read_body

source ·
pub async fn read_body<B>(
    headers: &HeaderMap,
    body: B,
    max_body_size: u32,
) -> Result<(Vec<u8>, bool), HttpError>
where B: HttpBody<Error = Error> + Send + 'static, B::Data: Send,
Expand description

Read a data from hyper::body::HttpBody and return the data if it is valid JSON and within the allowed size range.

Returns Ok((bytes, single)) if the body was in valid size range; and a bool indicating whether the JSON-RPC request is a single or a batch. Returns Err if the body was too large or the body couldn’t be read.