Struct simple_hyper_client::RequestBuilder
source · pub struct RequestBuilder<'a> { /* private fields */ }
Expand description
An HTTP request builder
This is created through Client::get()
, Client::post()
etc.
You need to call send()
to actually send the request over the network.
If you don’t want to send it and just want the resultant Request, you
can call RequestBuilder::build.
Implementations§
source§impl<'a> RequestBuilder<'a>
impl<'a> RequestBuilder<'a>
sourcepub fn body<B: Into<SharedBody>>(self, body: B) -> Self
pub fn body<B: Into<SharedBody>>(self, body: B) -> Self
Set the request body.
sourcepub fn header<H: Header>(self, header: H) -> Self
pub fn header<H: Header>(self, header: H) -> Self
Set a single header using HeaderMapExt::typed_insert()
.
sourcepub fn build(self) -> Result<Request<SharedBody>, Error>
pub fn build(self) -> Result<Request<SharedBody>, Error>
Get the resultant Request.
Prefer RequestBuilder::send unless you have a specific need to get the resultant Request.