Print out html

This commit is contained in:
Greg Shuflin 2023-01-12 02:47:42 -08:00
parent dcdf12f358
commit 4c84a2c76f

View File

@ -1,11 +1,10 @@
use std::env::args;
use anyhow::anyhow;
use hyper::{Request, Uri};
use hyper::Body;
use hyper::{Request, Uri};
use tokio::net::TcpStream;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let arguments: Vec<String> = args().collect();
@ -34,9 +33,13 @@ async fn main() -> anyhow::Result<()> {
.header(hyper::header::HOST, authority.as_str())
.body(Body::from(""))?;
let mut res = sender.send_request(req).await?;
let res = sender.send_request(req).await?;
let body = res.into_body();
let body_bytes = hyper::body::to_bytes(body).await?;
println!("{:?}", res);
let body_text = String::from_utf8(body_bytes.to_vec())?;
println!("{}", body_text);
Ok(())
}