#[cfg(feature = "h2")]
use futures_lite::future::block_on;
#[cfg(feature = "h2")]
fn main() -> Result<(), Box<dyn std::error::Error>> {
block_on(async move {
let client = ugi::Client::builder()
.http2_only()
.bearer_auth("token")?
.build()?;
let res = client.get("https://api.example.com/v1/profile").await?;
let body = res.text().await?;
println!("{body}");
Ok(())
})
}
#[cfg(not(feature = "h2"))]
fn main() {
eprintln!("This example requires the `h2` feature.");
}