[−][src]Trait pact_matching::models::HttpPart
Trait to specify an HTTP part of a message. It encapsulates the shared parts of a request and response.
Required methods
fn headers(&self) -> &Option<HashMap<String, Vec<String>>>
Returns the headers of the HTTP part.
fn body(&self) -> &OptionalBody
Returns the body of the HTTP part.
fn matching_rules(&self) -> &MatchingRules
Returns the matching rules of the HTTP part.
fn generators(&self) -> &Generators
Returns the generators of the HTTP part.
Provided methods
fn content_type(&self) -> String
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.
fn detect_content_type(&self) -> String
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.
fn content_type_enum(&self) -> DetectedContentType
Returns the general content type (ignoring subtypes)
fn has_header(&self, header_name: &String) -> bool
Checks if the HTTP Part has the given header
fn lookup_header_value(&self, header_name: &String) -> Option<String>
Checks if the HTTP Part has the given header