# Struct actix_web::client::ClientRequest[−][src]

    pub struct ClientRequest { /* fields omitted */ }

An HTTP Client Request

    use actix_web::{actix, 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(())
                }),
        );
    }

## Methods

###

`impl ClientRequest`

[src]

####

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

[src]

Create request builder for `GET` request

####

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

[src]

Create request builder for `HEAD` request

####

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

[src]

Create request builder for `POST` request

####

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

[src]

Create request builder for `PUT` request

####

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

[src]

Create request builder for `DELETE` request

###

`impl ClientRequest`

[src]

####

`pub fn build() -> ClientRequestBuilder`

[src]

Create client request builder

####

`pub fn build_from<T: Into<ClientRequestBuilder>>( source: T ) -> ClientRequestBuilder`

[src]

Create client request builder

####

`pub fn uri(&self) -> &Uri`

[src]

Get the request URI

####

`pub fn set_uri(&mut self, uri: Uri)`

[src]

Set client request URI

####

`pub fn method(&self) -> &Method`

[src]

Get the request method

####

`pub fn set_method(&mut self, method: Method)`

[src]

Set HTTP `Method` for the request

####

`pub fn version(&self) -> Version`

[src]

Get HTTP version for the request

####

`pub fn set_version(&mut self, version: Version)`

[src]

Set http `Version` for the request

####

`pub fn headers(&self) -> &HeaderMap`

[src]

Get the headers from the request

####

`pub fn headers_mut(&mut self) -> &mut HeaderMap`

[src]

Get a mutable reference to the headers

####

`pub fn chunked(&self) -> bool`

[src]

is chunked encoding enabled

####

`pub fn upgrade(&self) -> bool`

[src]

is upgrade request

####

`pub fn content_encoding(&self) -> ContentEncoding`

[src]

Content encoding

####

`pub fn response_decompress(&self) -> bool`

[src]

Decompress response payload

####

`pub fn write_buffer_capacity(&self) -> usize`

[src]

Requested write buffer capacity

####

`pub fn body(&self) -> &Body`

[src]

Get body of this response

####

`pub fn set_body<B: Into<Body>>(&mut self, body: B)`

[src]

Set a body

####

`pub fn send(self) -> SendRequest`

[src]

Send request

This method returns a future that resolves to a ClientResponse

## Trait Implementations

###

`impl Default for ClientRequest`

[src]

####

`fn default() -> ClientRequest`

[src]

Returns the "default value" for a type. Read more

###

`impl Debug for ClientRequest`

[src]

####

`fn fmt(&self, f: &mut Formatter) -> Result`

[src]

Formats the value using the given formatter. Read more

## Auto Trait Implementations

###

`impl !Send for ClientRequest`

###

`impl !Sync for ClientRequest`

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g. `str,u8` or `String,struct:Vec,test`)