Struct cabot::request::RequestBuilder [] [src]

pub struct RequestBuilder { /* fields omitted */ }

Construct Request

Methods

impl RequestBuilder
[src]

[src]

Create a new RequestBuilder with the given url.

url will be parsed to get the host to contact and the uri to send. When building a request object after creating the builder, the http method will be GET with neither header nor body and the http version will be HTTP/1.1

[src]

Replace the url in case the RequestBuilder is used many time for multiple query.

[src]

Set the http method such as GET POST. Default value is GET.

[src]

Set the protocol version to use.. Default value is HTTP/1.1.

[src]

Add a HTTP header.

[src]

Add many headers.

[src]

Override the default user-agent

Important: don't add a user_agent usering the add_header function to avoid a duplicate header User-Agent

[src]

Set a response body.

If a body is set, the Content-Length headers is added by cabot.

[src]

Set a body to send in the query. By default a query has no body.

[src]

Construct the Request. To perform the query, a Client has to be created.

Errors:

  • CabotError::ParseUrlError in case the url is not parsable
  • CabotError::OpaqueUrlError in case the url is parsed but miss informations such as hostname.