DefaultHttpRequestMatcher Class

Matches requests based on HTTP method, URL with sorted query parameters, and request body.

public sealed class DefaultHttpRequestMatcher : IHttpRequestMatcher
Implements

Constructors

NameDescription
DefaultHttpRequestMatcher(bool)Initializes a new instance of the DefaultHttpRequestMatcher class.

DefaultHttpRequestMatcher(bool)

DefaultHttpRequestMatcher.cs

Initializes a new instance of the DefaultHttpRequestMatcher class.

public DefaultHttpRequestMatcher(bool matchRequestBody = true)

Parameters

matchRequestBody bool
When true (the default), the request body is part of the fingerprint, so two requests to the same URL that carry different payloads do not match each other. Set it to false for endpoints whose body varies between runs (a nonce or a timestamp) and should not affect matching.

Properties

NameDescription
IgnoringRequestBodyGets an instance that matches on method and URL only, ignoring the request body.
InstanceGets the default instance, which includes the request body in the fingerprint.
MatchRequestBodyGets a value indicating whether the request body is part of the fingerprint.

IgnoringRequestBody

DefaultHttpRequestMatcher.cs

Gets an instance that matches on method and URL only, ignoring the request body.

public static DefaultHttpRequestMatcher IgnoringRequestBody { get; }

Gets the default instance, which includes the request body in the fingerprint.

public static DefaultHttpRequestMatcher Instance { get; }

Gets a value indicating whether the request body is part of the fingerprint.

public bool MatchRequestBody { get; }

Property value

bool

Methods

NameDescription
ComputeFingerprint(HttpRecordingEntry)Computes a deterministic fingerprint string for a request. Two requests that should match must produce the same fingerprint.

ComputeFingerprint(HttpRecordingEntry)

DefaultHttpRequestMatcher.cs

Computes a deterministic fingerprint string for a request. Two requests that should match must produce the same fingerprint.

public string ComputeFingerprint(HttpRecordingEntry entry)

Parameters

entry HttpRecordingEntry

Returns

string