Struct wclient::RequestBuilder [−][src]
pub struct RequestBuilder { /* fields omitted */ }Expand description
Helper builder for Request
- The Request builder has a constructor for each HTTP method (
get,post,put, …) and a set of member functions to set the request members. - A
buildfunction createsRequest.
use wclient::RequestBuilder;
use json::object;
let data = object! {
name: "John",
surname: "Smith"
};
let mut request = RequestBuilder::post("Http://web.myservice.com/user")
.header("Accept", "application/json")
.param("id", "12345")
.json(&data)
.build();Implementations
Default constructor
Creates a CONNECT request builder
Creates a DELETE request builder
Creates a GET request builder
Creates a HEAD request builder
Creates a OPTIONS request builder
Creates a PATCH request builder
Creates a POST request builder
Creates a PUT request builder
Creates a TRACE request builder
Sets the Request configuration
Adds a set of headers. If there is an existing header with the same key, it is overrriden.
Note: header names are case-insensitive.
Adds a header. If there is an existing header with the same `name’, it is overrriden.
Note: header names are case-insensitive.
Adds a set of parameters. If there is an existing parameter with the same key, it is overrriden.
Note: parameter names are case-sensitive.
Adds a parameter. If there is an existing parameter with the same key, it is overrriden.
Note: parameter names are case-sensitive.
Adds a set of cookies. If there is an existing cookie with the same key, it is overrriden.
Note: cookie names are case-sensitive.
Adds a cookie. If there is an existing cookie with the same key, it is overrriden.
Note: cookie names are case-sensitive.
Sets a request body. The Request takes ownership of the data buffer.
Sets a json object as request body. The data object is marshaled into a buffer using UTF8 coding.