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]

[src]

Set HTTP uri of request.

[src]

Set HTTP method of this request.

[src]

Set HTTP version of this request.

By default requests's http version depends on network stream

[src]

Add a header.

Header get 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();
}

[src]

Replace a header.

[src]

Set content encoding.

By default ContentEncoding::Identity is used.

[src]

Enables automatic chunked transfer encoding

[src]

Enable connection upgrade

[src]

Set request's content type

[src]

Set content length

[src]

Set a cookie

use actix_web::headers::Cookie;
use actix_web::client::ClientRequest;

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

Remove cookie, cookie has to be cookie from HttpRequest::cookies() method.

[src]

Do not add default request headers. By default Accept-Encoding header is set.

[src]

Disable automatic decompress response body

[src]

Set write buffer capacity

[src]

Send request using custom connector

[src]

Send request using existing Connection

[src]

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

[src]

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

[src]

Set a body and generate ClientRequest.

ClientRequestBuilder can not be used after this call.

[src]

Set a json body and generate ClientRequest

ClientRequestBuilder can not be used after this call.

[src]

Set an empty body and generate ClientRequest

ClientRequestBuilder can not be used after this call.

[src]

This method construct new ClientRequestBuilder