ugi 0.2.1

Runtime-agnostic Rust request client with HTTP/1.1, HTTP/2, HTTP/3, H2C, WebSocket, SSE, and gRPC support
Documentation
use bytes::Bytes;
use futures_lite::future::block_on;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    block_on(async move {
        let client = ugi::Client::builder().build()?;
        let body = async_stream::stream! {
            yield Ok(Bytes::from_static(b"{\"step\":1}\n"));
            yield Ok(Bytes::from_static(b"{\"step\":2}\n"));
        };

        let req = client
            .post("https://upload.example.com/ingest")
            .header("content-type", "application/x-ndjson")?
            .body_stream(Box::pin(body));
        let res = req.await?;

        println!("upload status={}", res.status().as_u16());
        Ok(())
    })
}