mirror of
https://github.com/fafhrd91/actix-web
synced 2025-09-02 01:31:57 +02:00
better doc api examples
This commit is contained in:
@@ -31,19 +31,18 @@ use httprequest::HttpRequest;
|
||||
/// # extern crate tokio;
|
||||
/// # use futures::Future;
|
||||
/// # use std::process;
|
||||
/// use actix_web::client::ClientRequest;
|
||||
/// use actix_web::{actix, client};
|
||||
///
|
||||
/// fn main() {
|
||||
/// let mut sys = actix_web::actix::System::new("test");
|
||||
///
|
||||
/// sys.block_on(
|
||||
/// ClientRequest::get("http://www.rust-lang.org") // <- Create request builder
|
||||
/// actix::run(
|
||||
/// || client::ClientRequest::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);
|
||||
/// # actix::System::current().stop();
|
||||
/// Ok(())
|
||||
/// }),
|
||||
/// );
|
||||
|
Reference in New Issue
Block a user