[][src]Struct pact_matching::models::Response

pub struct Response {
    pub status: u16,
    pub headers: Option<HashMap<String, Vec<String>>>,
    pub body: OptionalBody,
    pub matching_rules: MatchingRules,
    pub generators: Generators,
}

Struct that defines the response.

Fields

status: u16

Response status

headers: Option<HashMap<String, Vec<String>>>

Response headers

body: OptionalBody

Response body

matching_rules: MatchingRules

Response matching rules

generators: Generators

Response generators

Methods

impl Response[src]

pub fn from_json(response: &Value, _: &PactSpecification) -> Response[src]

Build a Response from a Value struct.

pub fn default_response() -> Response[src]

Returns a default response: Status 200

pub fn to_json(&self, spec_version: &PactSpecification) -> Value[src]

Converts this response to a Value struct.

pub fn differences_from(
    &self,
    other: &Response
) -> Vec<(DifferenceType, String)>
[src]

Return a description of all the differences from the other response

Trait Implementations

impl HttpPart for Response[src]

fn content_type(&self) -> String[src]

Determine the content type of the HTTP part. If a Content-Type header is present, the value of that header will be returned. Otherwise, the body will be inspected. Read more

fn detect_content_type(&self) -> String[src]

Tries to detect the content type of the body by matching some regular expressions against the first 32 characters. Default to text/plain if no match is found. Read more

fn content_type_enum(&self) -> DetectedContentType[src]

Returns the general content type (ignoring subtypes)

fn has_header(&self, header_name: &String) -> bool[src]

Checks if the HTTP Part has the given header

fn lookup_header_value(&self, header_name: &String) -> Option<String>[src]

Checks if the HTTP Part has the given header

impl Clone for Response[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl PartialEq<Response> for Response[src]

impl Eq for Response[src]

impl Display for Response[src]

impl Debug for Response[src]

impl Hash for Response[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given [Hasher]. Read more

Auto Trait Implementations

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> Erased for T

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Err = <U as TryFrom<T>>::Err