lychee-client/src/main.rs

19 lines
527 B
Rust
Raw Normal View History

use hyper_tls::HttpsConnector;
use hyper::{Client, Uri};
use std::str;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let https = HttpsConnector::new();
let client = Client::builder().build::<_, hyper::Body>(https);
let res = client.get(Uri::from_static("https://test.louis-vallat.xyz")).await?;
println!("{}", res.status().as_u16());
let buf = hyper::body::to_bytes(res).await?;
let s = str::from_utf8(&buf).unwrap();
println!("{:?}", s);
Ok(())
}