awc异步 HTTP 和 WebSocket 客户端库
awc (Actix Web Client) 是基于 Actix 生态构建的异步 HTTP 和 WebSocket 客户端库。
示例
use actix_rt::System;
use awc::Client;
fn main() {
    System::new().block_on(async {
        let client = Client::default();
        let res = client
            .get("http://www.rust-lang.org")    // <- Create request builder
            .insert_header(("User-Agent", "Actix-web"))
            .send()                             // <- Send http request
            .await;
        println!("Response: {:?}", res);        // <- server http response
    });
}评论
