pub struct ResponseCondition {
pub condition_type: ResponseConditionType,
pub status_code: Option<StatusCodeMatcher>,
pub raw_body: Option<BodyMatcher>,
pub body: Option<BTreeMap<String, BodyMatcher>>,
}Expand description
A response condition that determines if a secret is valid or invalid
Fields§
§condition_type: ResponseConditionTypeWhether this condition indicates a valid or invalid secret
status_code: Option<StatusCodeMatcher>Optional status code matcher
raw_body: Option<BodyMatcher>Optional raw body matcher (before parsing)
body: Option<BTreeMap<String, BodyMatcher>>Optional parsed body matchers (after JSON parsing) Maps JSON paths to matchers Example: {“message.stack[2].success.status”: BodyMatcher}
Implementations§
Source§impl ResponseCondition
impl ResponseCondition
Sourcepub fn matches(&self, status_code: u16, body: &str) -> ResponseConditionResult
pub fn matches(&self, status_code: u16, body: &str) -> ResponseConditionResult
Determines if a ResponseCondition matches a given status code and body It does this by checking against each of the optional conditions and aggregating the results.
Consider the example of a ResponseCondition with the following conditions:
- status_code: 200
- raw_body: “success”
If the status code is 200, the raw body is “success”, ResponseCondition matches. If the status code is 200, the raw body is “failure”, then the ResponseCondition does not match.
What happens next depends on the ResponseConditionType and whether or not the condition matched:
- Matched and Invalid -> Invalid
- Matched and Valid -> Valid
- Not matched -> NotChecked
Trait Implementations§
Source§impl Clone for ResponseCondition
impl Clone for ResponseCondition
Source§fn clone(&self) -> ResponseCondition
fn clone(&self) -> ResponseCondition
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ResponseCondition
impl Debug for ResponseCondition
Source§impl<'de> Deserialize<'de> for ResponseCondition
impl<'de> Deserialize<'de> for ResponseCondition
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>,
Source§impl Hash for ResponseCondition
impl Hash for ResponseCondition
Source§impl PartialEq for ResponseCondition
impl PartialEq for ResponseCondition
Source§impl Serialize for ResponseCondition
impl Serialize for ResponseCondition
impl Eq for ResponseCondition
impl StructuralPartialEq for ResponseCondition
Auto Trait Implementations§
impl Freeze for ResponseCondition
impl RefUnwindSafe for ResponseCondition
impl Send for ResponseCondition
impl Sync for ResponseCondition
impl Unpin for ResponseCondition
impl UnwindSafe for ResponseCondition
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more