1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-25 06:39:22 +02:00

migrate integration testing to new crate (#2112)

This commit is contained in:
Rob Ede
2021-04-02 08:26:59 +01:00
committed by GitHub
parent 50dc13f280
commit c54a0713de
41 changed files with 789 additions and 644 deletions

25
awc/examples/client.rs Normal file
View File

@ -0,0 +1,25 @@
use actix_http::Error;
#[actix_web::main]
async fn main() -> Result<(), Error> {
std::env::set_var("RUST_LOG", "actix_http=trace");
env_logger::init();
let client = awc::Client::new();
// Create request builder, configure request and send
let mut response = client
.get("https://www.rust-lang.org/")
.append_header(("User-Agent", "Actix-web"))
.send()
.await?;
// server http response
println!("Response: {:?}", response);
// read response body
let body = response.body().await?;
println!("Downloaded: {:?} bytes", body.len());
Ok(())
}