http client
This commit is contained in:
parent
24db811c57
commit
d59523b009
12 changed files with 396 additions and 5 deletions
16
examples/request_meex.rs
Normal file
16
examples/request_meex.rs
Normal file
|
@ -0,0 +1,16 @@
|
|||
use std::str::FromStr;
|
||||
|
||||
use ezhttp::{client::{HttpClient, RequestBuilder}, request::URL};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
let response = HttpClient::default().send(
|
||||
RequestBuilder::get(
|
||||
URL::from_str("https://meex.lol/dku?key=value#hex_id")
|
||||
.expect("url error")
|
||||
).build()
|
||||
).await.expect("request error");
|
||||
println!("status code: {}", response.status_code);
|
||||
println!("headers: {}", response.headers.entries().iter().map(|o| format!("{}: {}", o.0, o.1)).collect::<Vec<String>>().join("; "));
|
||||
println!("body: {} bytes", response.body.as_text().unwrap().len());
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue