Struct pact_models::v4::http_parts::HttpRequest[][src]

pub struct HttpRequest {
    pub method: String,
    pub path: String,
    pub query: Option<HashMap<String, Vec<String>>>,
    pub headers: Option<HashMap<String, Vec<String>>>,
    pub body: OptionalBody,
    pub matching_rules: MatchingRules,
    pub generators: Generators,
}
Expand description

Struct that defines the HTTP request.

Fields

method: String

Request method

path: String

Request path

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

Request query string

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

Request headers

body: OptionalBody

Request body

matching_rules: MatchingRules

Request matching rules

generators: Generators

Request generators

Implementations

Builds a HttpRequest from a JSON Value struct.

Converts this HttpRequest to a Value struct.

Convert this request to a V3 request struct

Determine the content type of the request. Returns the content type of the body, otherwise if a Content-Type header is present, the value of that header will be returned. Otherwise, the body will be inspected.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

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

Returns the headers of the HTTP part.

Returns the headers of the HTTP part in a mutable form.

Returns the body of the HTTP part.

Returns the matching rules of the HTTP part.

Returns the generators of the HTTP part.

Lookup up the content type for the part

Tries to detect the content type of the body by matching some regular expressions against the first 32 characters. Read more

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

Checks if the HTTP Part has the given header

Checks if the HTTP Part has the given header

If the body is a textual type (non-binary)

Convenience method to add a header

Builds a map of generators from the generators and matching rules

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Compare self to key and return true if they are equal.

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more