pub struct RequestResponseInteraction {
pub id: Option<String>,
pub description: String,
pub provider_states: Vec<ProviderState>,
pub request: Request,
pub response: Response,
}
Expand description
Struct that defines an interaction (request and response pair)
Fields
id: Option<String>
Interaction ID. This will only be set if the Pact file was fetched from a Pact Broker
description: String
Description of this interaction. This needs to be unique in the pact file.
provider_states: Vec<ProviderState>
Optional provider states for the interaction.
See <https://docs.pact.io/getting_started/provider_states>
for more info on provider states.
request: Request
Request of the interaction
response: Response
Response of the interaction
Implementations
sourceimpl RequestResponseInteraction
impl RequestResponseInteraction
sourcepub fn from_json(
index: usize,
pact_json: &Value,
spec_version: &PactSpecification
) -> Result<RequestResponseInteraction>
pub fn from_json(
index: usize,
pact_json: &Value,
spec_version: &PactSpecification
) -> Result<RequestResponseInteraction>
Constructs an Interaction
from the Value
struct.
sourcepub fn to_json(&self, spec_version: &PactSpecification) -> Value
pub fn to_json(&self, spec_version: &PactSpecification) -> Value
Converts this interaction to a Value
struct.
sourcepub fn conflicts_with(&self, other: &dyn Interaction) -> Vec<PactConflict>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn conflicts_with(&self, other: &dyn Interaction) -> Vec<PactConflict>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Returns list of conflicts if this interaction conflicts with the other interaction.
Two interactions conflict if they have the same description and provider state, but they request and responses are not equal
sourcepub fn schema(_spec_version: PactSpecification) -> Value
pub fn schema(_spec_version: PactSpecification) -> Value
Generate the JSON schema properties for the given Pact specification
Trait Implementations
sourceimpl Clone for RequestResponseInteraction
impl Clone for RequestResponseInteraction
sourcefn clone(&self) -> RequestResponseInteraction
fn clone(&self) -> RequestResponseInteraction
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for RequestResponseInteraction
impl Debug for RequestResponseInteraction
sourceimpl Default for RequestResponseInteraction
impl Default for RequestResponseInteraction
sourceimpl Display for RequestResponseInteraction
impl Display for RequestResponseInteraction
sourceimpl Hash for RequestResponseInteraction
impl Hash for RequestResponseInteraction
sourceimpl Interaction for RequestResponseInteraction
impl Interaction for RequestResponseInteraction
sourcefn is_request_response(&self) -> bool
fn is_request_response(&self) -> bool
If this is a request/response interaction
sourcefn as_request_response(&self) -> Option<RequestResponseInteraction>
fn as_request_response(&self) -> Option<RequestResponseInteraction>
Returns the request/response interaction if it is one
sourcefn is_message(&self) -> bool
fn is_message(&self) -> bool
If this is a message interaction
sourcefn as_message(&self) -> Option<Message>
fn as_message(&self) -> Option<Message>
Returns the message interaction if it is one
sourcefn id(&self) -> Option<String>
fn id(&self) -> Option<String>
Interaction ID. This will only be set if the Pact file was fetched from a Pact Broker
sourcefn description(&self) -> String
fn description(&self) -> String
Description of this interaction. This needs to be unique in the pact file.
sourcefn set_description(&mut self, description: &str)
fn set_description(&mut self, description: &str)
Set the description of this interaction. This needs to be unique in the pact file.
sourcefn provider_states(&self) -> Vec<ProviderState>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
fn provider_states(&self) -> Vec<ProviderState>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Optional provider states for the interaction.
See <https://docs.pact.io/getting_started/provider_states>
for more info on provider states. Read more
sourcefn provider_states_mut(&mut self) -> &mut Vec<ProviderState>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
fn provider_states_mut(&mut self) -> &mut Vec<ProviderState>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Mutable Optional provider states for the interaction.
See <https://docs.pact.io/getting_started/provider_states>
for more info on provider states. Read more
sourcefn contents(&self) -> OptionalBody
fn contents(&self) -> OptionalBody
Some interactions have multiple contents (like request/response), so it is impossible to know which to return for this method
Body of the response or message
sourcefn contents_for_verification(&self) -> OptionalBody
fn contents_for_verification(&self) -> OptionalBody
The contents of the part to use for verification. For example, with HTTP interactions, this will be the response body Read more
sourcefn content_type(&self) -> Option<ContentType>
fn content_type(&self) -> Option<ContentType>
Some interactions have multiple contents (like request/response), so it is impossible to know which to return for this method
Determine the content type of the interaction. If a Content-Type
header or metadata value is present, the
value of that value will be returned. Otherwise, the contents will be inspected. Read more
sourcefn as_v4(&self) -> Option<Box<dyn V4Interaction + Send + Sync>>
fn as_v4(&self) -> Option<Box<dyn V4Interaction + Send + Sync>>
Returns the interaction in V4 format
sourcefn as_v4_mut(&mut self) -> Option<&mut dyn V4Interaction>
fn as_v4_mut(&mut self) -> Option<&mut dyn V4Interaction>
Returns a mutable reference for the interaction. If the interaction is not a V4 format,
will return None. The as_v4
method can convert to V4 format (via cloning the data). Read more
sourcefn as_v4_http(&self) -> Option<SynchronousHttp>
fn as_v4_http(&self) -> Option<SynchronousHttp>
Returns the interaction in V4 format
sourcefn as_v4_async_message(&self) -> Option<AsynchronousMessage>
fn as_v4_async_message(&self) -> Option<AsynchronousMessage>
Returns the interaction in V4 format
sourcefn as_v4_sync_message(&self) -> Option<SynchronousMessage>
fn as_v4_sync_message(&self) -> Option<SynchronousMessage>
Returns the interaction in V4 format
sourcefn as_v4_http_mut(&mut self) -> Option<&mut SynchronousHttp>
fn as_v4_http_mut(&mut self) -> Option<&mut SynchronousHttp>
Returns the interaction in V4 format
sourcefn as_v4_async_message_mut(&mut self) -> Option<&mut AsynchronousMessage>
fn as_v4_async_message_mut(&mut self) -> Option<&mut AsynchronousMessage>
Returns the interaction in V4 format
sourcefn as_v4_sync_message_mut(&mut self) -> Option<&mut SynchronousMessage>
fn as_v4_sync_message_mut(&mut self) -> Option<&mut SynchronousMessage>
Returns the interaction in V4 format
sourcefn boxed(&self) -> Box<dyn Interaction + Send + Sync>
fn boxed(&self) -> Box<dyn Interaction + Send + Sync>
Clones this interaction and wraps it in a Box
sourcefn arced(&self) -> Arc<dyn Interaction + Send + Sync>
fn arced(&self) -> Arc<dyn Interaction + Send + Sync>
Clones this interaction and wraps it in an Arc
sourcefn thread_safe(&self) -> Arc<Mutex<dyn Interaction + Send + Sync>>
fn thread_safe(&self) -> Arc<Mutex<dyn Interaction + Send + Sync>>
Clones this interaction and wraps it in an Arc and Mutex
sourcefn matching_rules(&self) -> Option<MatchingRules>
fn matching_rules(&self) -> Option<MatchingRules>
Some interactions have multiple contents (like request/response), so it is impossible to know which to return for this method
Returns the matching rules associated with this interaction (if there are any)
sourcefn is_v4_http(&self) -> bool
fn is_v4_http(&self) -> bool
If the interaction is V4 HTTP
sourcefn is_v4_async_message(&self) -> bool
fn is_v4_async_message(&self) -> bool
If the interaction is a V4 message
sourcefn is_v4_sync_message(&self) -> bool
fn is_v4_sync_message(&self) -> bool
If the interaction is a V4 synchronous request/response message
sourceimpl PactJsonVerifier for RequestResponseInteraction
impl PactJsonVerifier for RequestResponseInteraction
sourcefn verify_json(
path: &str,
pact_json: &Value,
strict: bool,
spec_version: PactSpecification
) -> Vec<PactFileVerificationResult>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
fn verify_json(
path: &str,
pact_json: &Value,
strict: bool,
spec_version: PactSpecification
) -> Vec<PactFileVerificationResult>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Verify the JSON format. Will return an error if the list contains any Error result
sourceimpl PartialEq<RequestResponseInteraction> for RequestResponseInteraction
impl PartialEq<RequestResponseInteraction> for RequestResponseInteraction
sourcefn eq(&self, other: &RequestResponseInteraction) -> bool
fn eq(&self, other: &RequestResponseInteraction) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &RequestResponseInteraction) -> bool
fn ne(&self, other: &RequestResponseInteraction) -> bool
This method tests for !=
.
impl Eq for RequestResponseInteraction
impl StructuralEq for RequestResponseInteraction
impl StructuralPartialEq for RequestResponseInteraction
Auto Trait Implementations
impl RefUnwindSafe for RequestResponseInteraction
impl Send for RequestResponseInteraction
impl Sync for RequestResponseInteraction
impl Unpin for RequestResponseInteraction
impl UnwindSafe for RequestResponseInteraction
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more