pub enum MockMode {
Simulate,
Spy,
Capture,
}Expand description
High-level operating mode for MockServer (set via PUT /mockserver/mode,
read via GET /mockserver/mode).
Each mode packages the common record / replay / pass-through workflows into a
single switch (a convenience over attemptToProxyIfNoMatchingExpectation):
MockMode::Simulate— match expectations and return mocks; unmatched requests get a404. This is the default (proxy-on-no-match disabled).MockMode::Spy— match expectations and return mocks, but forward unmatched requests to the real upstream so they are served live and recorded (proxy-on-no-match enabled).MockMode::Capture— forward and record; with no expectations defined this captures all traffic. Backed by the same proxy flag asMockMode::Spy.
Variants§
Simulate
Match expectations; unmatched requests get a 404 (default).
Spy
Match expectations; unmatched requests forwarded to the upstream and recorded.
Capture
Forward and record all traffic.
Implementations§
Source§impl MockMode
impl MockMode
Sourcepub fn as_str(&self) -> &'static str
pub fn as_str(&self) -> &'static str
The wire value for this mode (the mode query parameter / JSON field).
Sourcepub fn proxy_unmatched_requests(&self) -> bool
pub fn proxy_unmatched_requests(&self) -> bool
Whether, in this mode, a request matching no expectation is proxied to its
upstream (and thereby recorded) rather than answered with a 404.
Trait Implementations§
impl Copy for MockMode
impl Eq for MockMode
impl StructuralPartialEq for MockMode
Auto Trait Implementations§
impl Freeze for MockMode
impl RefUnwindSafe for MockMode
impl Send for MockMode
impl Sync for MockMode
impl Unpin for MockMode
impl UnsafeUnpin for MockMode
impl UnwindSafe for MockMode
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.