Skip to main content

write_request

Function write_request 

Source
pub async fn write_request<W: AsyncWrite + Unpin>(
    writer: &mut W,
    head: &RequestHead,
    body: Option<&[u8]>,
) -> Result<(), HttpError>
Expand description

Serialize head plus an optional length-delimited body onto writer.

A Content-Length is always written (0 for an absent body) unless the caller already supplied one, so every request is self-delimiting: a proxy or server never has to guess where the body ends.