Struct actix_web::client::ClientRequestBuilder[][src]

pub struct ClientRequestBuilder { /* fields omitted */ }

An HTTP Client request builder

This type can be used to construct an instance of ClientRequest through a builder-like pattern.

Methods

impl ClientRequestBuilder
[src]

Important traits for &'a mut R

Set HTTP URI of request.

Important traits for &'a mut R

Set HTTP method of this request.

Set HTTP method of this request.

Important traits for &'a mut R

Set HTTP version of this request.

By default requests's HTTP version depends on network stream

Important traits for &'a mut R

Append a header.

Header gets appended to existing header. To override header use set_header() method.

use http::header;

fn main() {
    let req = ClientRequest::build()
        .header("X-TEST", "value")
        .header(header::CONTENT_TYPE, "application/json")
        .finish()
        .unwrap();
}

Important traits for &'a mut R

Set a header.

Important traits for &'a mut R

Set a header only if it is not yet set.

Important traits for &'a mut R

Set content encoding.

By default ContentEncoding::Identity is used.

Important traits for &'a mut R

Enables automatic chunked transfer encoding

Important traits for &'a mut R

Enable connection upgrade

Important traits for &'a mut R

Set request's content type

Important traits for &'a mut R

Set content length

Important traits for &'a mut R

Set a cookie

use actix_web::{client, http};

fn main() {
    let req = client::ClientRequest::build()
        .cookie(
            http::Cookie::build("name", "value")
                .domain("www.rust-lang.org")
                .path("/")
                .secure(true)
                .http_only(true)
                .finish(),
        )
        .finish()
        .unwrap();
}

Important traits for &'a mut R

Do not add default request headers. By default Accept-Encoding and User-Agent headers are set.

Important traits for &'a mut R

Disable automatic decompress response body

Important traits for &'a mut R

Set write buffer capacity

Default buffer capacity is 32kb

Important traits for &'a mut R

Set request timeout

Request timeout is a total time before response should be received. Default value is 5 seconds.

Important traits for &'a mut R

Send request using custom connector

Important traits for &'a mut R

Send request using existing Connection

Important traits for &'a mut R

This method calls provided closure with builder reference if value is true.

Important traits for &'a mut R

This method calls provided closure with builder reference if value is Some.

Set a body and generate ClientRequest.

ClientRequestBuilder can not be used after this call.

Set a JSON body and generate ClientRequest

ClientRequestBuilder can not be used after this call.

Set a urlencoded body and generate ClientRequest

ClientRequestBuilder can not be used after this call.

Set a streaming body and generate ClientRequest.

ClientRequestBuilder can not be used after this call.

Set an empty body and generate ClientRequest

ClientRequestBuilder can not be used after this call.

This method construct new ClientRequestBuilder

Trait Implementations

impl Debug for ClientRequestBuilder
[src]

Formats the value using the given formatter. Read more

impl<'a, S: 'static> From<&'a HttpRequest<S>> for ClientRequestBuilder
[src]

Create ClientRequestBuilder from HttpRequest

It is useful for proxy requests. This implementation copies all request headers and the method.

Performs the conversion.

Auto Trait Implementations

impl !Send for ClientRequestBuilder

impl !Sync for ClientRequestBuilder