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.
Auto Trait Implementations§
impl<'a> !Freeze for RequestBuilder<'a>
impl<'a> !RefUnwindSafe for RequestBuilder<'a>
impl<'a> Send for RequestBuilder<'a>
impl<'a> Sync for RequestBuilder<'a>
impl<'a> Unpin for RequestBuilder<'a>
impl<'a> !UnwindSafe for RequestBuilder<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more