pub async fn read_body<B>(
headers: &HeaderMap,
body: B,
max_body_size: u32,
) -> Result<(Vec<u8>, bool), HttpError>
Available on crate feature
http-helpers
only.Expand description
Read data from a HTTP body 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.