pub struct RequestBuilder<'a, H> { /* private fields */ }Expand description
Builder for constructing test requests with a fluent API.
Use the methods on TestClient to create a request builder,
then chain configuration methods and call send to execute.
§Example
ⓘ
let response = client
.post("/api/items")
.header("Content-Type", "application/json")
.body(r#"{"name": "Widget"}"#)
.send();Implementations§
Source§impl<'a, H: Handler + 'static> RequestBuilder<'a, H>
impl<'a, H: Handler + 'static> RequestBuilder<'a, H>
Sourcepub fn header_str(self, name: impl Into<String>, value: &str) -> Self
pub fn header_str(self, name: impl Into<String>, value: &str) -> Self
Sets a request header with a string value.
Sets a cookie for this request only.
This does not affect the client’s cookie jar.
Sourcepub fn send(self) -> TestResponse
pub fn send(self) -> TestResponse
Auto Trait Implementations§
impl<'a, H> Freeze for RequestBuilder<'a, H>
impl<'a, H> !RefUnwindSafe for RequestBuilder<'a, H>
impl<'a, H> Send for RequestBuilder<'a, H>
impl<'a, H> Sync for RequestBuilder<'a, H>
impl<'a, H> Unpin for RequestBuilder<'a, H>
impl<'a, H> !UnwindSafe for RequestBuilder<'a, H>
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).