pub struct ClientRequest { /* private fields */ }
Expand description

An HTTP Client Request

use actix_web::client;

fn main() {
    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);
                Ok(())
            }),
    );
}

Implementations

Create request builder for GET request

Create request builder for HEAD request

Create request builder for POST request

Create request builder for PUT request

Create request builder for DELETE request

Create client request builder

Create client request builder

Get the request URI

Set client request URI

Get the request method

Set HTTP Method for the request

Get HTTP version for the request

Set http Version for the request

Get the headers from the request

Get a mutable reference to the headers

is chunked encoding enabled

is upgrade request

Content encoding

Decompress response payload

Requested write buffer capacity

Get body of this response

Set a body

Send request

This method returns a future that resolves to a ClientResponse

Trait Implementations

Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.