dream_http_client/matching

Request matching logic

Determines if a request matches a recorded request based on configurable matching criteria (method, URL, headers, body).

Types

Configuration for request matching

pub type MatchingConfig {
  MatchingConfig(
    match_method: Bool,
    match_url: Bool,
    match_headers: Bool,
    match_body: Bool,
  )
}

Constructors

  • MatchingConfig(
      match_method: Bool,
      match_url: Bool,
      match_headers: Bool,
      match_body: Bool,
    )

Values

pub fn build_signature(
  request: recording.RecordedRequest,
  config: MatchingConfig,
) -> String

Build a request signature for matching

Creates a string signature from the request based on the matching configuration. This signature is used as a key to look up recordings.

pub fn match_url_only() -> MatchingConfig

Default matching configuration: match on method and URL only

This ignores headers and body, which is practical for most use cases since headers often contain timestamps, auth tokens, etc., and bodies may contain dynamic IDs.

pub fn requests_match(
  request1: recording.RecordedRequest,
  request2: recording.RecordedRequest,
  config: MatchingConfig,
) -> Bool

Check if two requests match based on the configuration

Search Document