Function sp_io::offchain::http_response_read_body
source · pub fn http_response_read_body(
request_id: HttpRequestId,
buffer: &mut [u8],
deadline: Option<Timestamp>
) -> Result<u32, HttpError>
Expand description
Read a chunk of body response to given buffer.
Returns the number of bytes written or an error in case a deadline
is reached or server closed the connection.
If 0
is returned it means that the response has been fully consumed
and the request_id
is now invalid.
NOTE this implies that response headers must be read before draining the body.
Passing None
as a deadline blocks forever.