[][src]Function actix_web::client::get

pub fn get<U: AsRef<str>>(uri: U) -> ClientRequestBuilder

Create request builder for GET requests

use actix_web::{actix, client};

fn main() {
    actix::run(
        || client::get("http://www.rust-lang.org")   // <- Create request builder
            .header("User-Agent", "Actix-web")
            .finish().unwrap()
            .send()                               // <- Send http request
            .map_err(|_| ())
            .and_then(|response| {                // <- server http response
                println!("Response: {:?}", response);
                Ok(())
            }),
    );
}