Skip to main content

write_request

Function write_request 

Source
pub async fn write_request<S: AsyncWrite + Unpin>(
    stream: &mut S,
    method: &str,
    host: &str,
    path: &str,
    headers: &[(&str, &str)],
    body: Option<&[u8]>,
) -> Result<()>
Expand description

Serialize and write an HTTP/1.1 request, then flush.

headers are sent verbatim; Host and Content-Length are added when absent.

ยงErrors

Propagates write/flush failures.