Struct restest::request::RequestBuilder [−][src]
pub struct RequestBuilder { /* fields omitted */ }
Expand description
Allows encode metadata in order to create a Request
.
This type can be created by calling either Request::get
or
Request::post
. Specifically, this type allows to encode the request
header with RequestBuilder::with_header
, and to create the final
Request
type by calling RequestBuilder::with_body
.
This allows to create Request
types, as shown in the following example:
use restest::Request;
use serde::Serialize;
let request = Request::get("user")
.with_header("token", "mom-said-yes")
.with_body(GetUserRequest {
login: String::from("jdoe")
});
#[derive(Serialize)]
struct GetUserRequest {
login: String,
}
Implementations
Adds a header key and value to the request.
Auto Trait Implementations
impl RefUnwindSafe for RequestBuilder
impl Send for RequestBuilder
impl Sync for RequestBuilder
impl Unpin for RequestBuilder
impl UnwindSafe for RequestBuilder
Blanket Implementations
Mutably borrows from an owned value. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more