Trait pact_matching::models::HttpPart[][src]

pub trait HttpPart {
    fn headers(&self) -> &Option<HashMap<String, String>>;
fn body(&self) -> &OptionalBody;
fn matching_rules(&self) -> &MatchingRules;
fn generators(&self) -> &Generators; fn content_type(&self) -> String { ... }
fn detect_content_type(&self) -> String { ... }
fn content_type_enum(&self) -> DetectedContentType { ... } }

Trait to specify an HTTP part of a message. It encapsulates the shared parts of a request and response.

Required Methods

Returns the headers of the HTTP part.

Returns the body of the HTTP part.

Returns the matching rules of the HTTP part.

Returns the generators of the HTTP part.

Provided Methods

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.

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.

Returns the general content type (ignoring subtypes)

Implementors