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

pub struct RequestBuilder { /* fields omitted */ }

Construct Request

Methods

impl RequestBuilder
[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

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

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

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

Add a HTTP header.

Add many headers.

Override the default user-agent

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

Set a response body.

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

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

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.