pub struct HttpExchange {
pub method: String,
pub path: String,
pub json_body: Option<Value>,
pub response: ScriptedResponse,
}Expand description
One expected request and its scripted response.
Fields§
§method: StringExpected uppercase HTTP method.
path: StringExpected path, including a query string when present.
json_body: Option<Value>Expected JSON body. None accepts any request body.
response: ScriptedResponseResponse returned after the request matches.
Implementations§
Source§impl HttpExchange
impl HttpExchange
Sourcepub fn new(
method: impl Into<String>,
path: impl Into<String>,
response: ScriptedResponse,
) -> Self
pub fn new( method: impl Into<String>, path: impl Into<String>, response: ScriptedResponse, ) -> Self
Creates an exchange that accepts any request body.
Sourcepub fn with_json_body(self, body: Value) -> Self
pub fn with_json_body(self, body: Value) -> Self
Requires an exact JSON request body.
Trait Implementations§
Source§impl Clone for HttpExchange
impl Clone for HttpExchange
Source§fn clone(&self) -> HttpExchange
fn clone(&self) -> HttpExchange
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for HttpExchange
impl RefUnwindSafe for HttpExchange
impl Send for HttpExchange
impl Sync for HttpExchange
impl Unpin for HttpExchange
impl UnsafeUnpin for HttpExchange
impl UnwindSafe for HttpExchange
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