pub struct Expectation {
pub id: Option<String>,
pub priority: Option<i32>,
pub http_request: HttpRequest,
pub http_response: Option<HttpResponse>,
pub http_forward: Option<HttpForward>,
pub http_error: Option<HttpError>,
pub times: Option<Times>,
pub time_to_live: Option<TimeToLive>,
}Expand description
A full expectation combining a request matcher with an action.
Fields§
§id: Option<String>§priority: Option<i32>§http_request: HttpRequest§http_response: Option<HttpResponse>§http_forward: Option<HttpForward>§http_error: Option<HttpError>§times: Option<Times>§time_to_live: Option<TimeToLive>Implementations§
Source§impl Expectation
impl Expectation
Sourcepub fn new(request: HttpRequest) -> Self
pub fn new(request: HttpRequest) -> Self
Create a new expectation with the given request matcher.
Sourcepub fn respond(self, response: HttpResponse) -> Self
pub fn respond(self, response: HttpResponse) -> Self
Set a response action.
Sourcepub fn forward(self, forward: HttpForward) -> Self
pub fn forward(self, forward: HttpForward) -> Self
Set a forward action.
Sourcepub fn time_to_live(self, ttl: TimeToLive) -> Self
pub fn time_to_live(self, ttl: TimeToLive) -> Self
Set the time-to-live.
Trait Implementations§
Source§impl Clone for Expectation
impl Clone for Expectation
Source§fn clone(&self) -> Expectation
fn clone(&self) -> Expectation
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 moreSource§impl Debug for Expectation
impl Debug for Expectation
Source§impl Default for Expectation
impl Default for Expectation
Source§fn default() -> Expectation
fn default() -> Expectation
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for Expectation
impl<'de> Deserialize<'de> for Expectation
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for Expectation
impl PartialEq for Expectation
Source§fn eq(&self, other: &Expectation) -> bool
fn eq(&self, other: &Expectation) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for Expectation
impl Serialize for Expectation
impl StructuralPartialEq for Expectation
Auto Trait Implementations§
impl Freeze for Expectation
impl RefUnwindSafe for Expectation
impl Send for Expectation
impl Sync for Expectation
impl Unpin for Expectation
impl UnsafeUnpin for Expectation
impl UnwindSafe for Expectation
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