#![deny(warnings)]
#[cfg(feature = "http3")]
#[cfg(not(target_arch = "wasm32"))]
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let client = reqwest::Client::builder().http3_prior_knowledge().build()?;
let url = match std::env::args().nth(1) {
Some(url) => url,
None => {
println!("No CLI URL provided, using default.");
"https://hyper.rs".into()
}
};
eprintln!("Fetching {url:?}...");
let res = client
.get(url)
.version(http::Version::HTTP_3)
.send()
.await?;
eprintln!("Response: {:?} {}", res.version(), res.status());
eprintln!("Headers: {:#?}\n", res.headers());
let body = res.text().await?;
println!("{body}");
Ok(())
}
#[cfg(any(target_arch = "wasm32", not(feature = "http3")))]
fn main() {}