Class StubHttpResponseSnapshotOptions

Namespace
XBullet.EasyTesting.Snapshots
Assembly
XBullet.EasyTesting.Snapshots.Http.dll

Controls which outbound HTTP response details are included in exchange snapshots.

public sealed class StubHttpResponseSnapshotOptions
Inheritance
StubHttpResponseSnapshotOptions
Inherited Members

Remarks

This mutable options object is not thread-safe. Its header sets remain live.

Properties

IgnoredHeaders

Gets headers excluded from snapshots.

public ISet<string> IgnoredHeaders { get; }

Property Value

ISet<string>

The live, options-owned case-insensitive set. By default it excludes authentication-info, date, server, cookie, tracing, request, and correlation headers that are sensitive or volatile.

IncludeBody

Gets or sets whether response content is included.

public bool IncludeBody { get; set; }

Property Value

bool

true to include the normalized body; otherwise, false. The default is true.

IncludeHeaders

Gets or sets whether response headers are included.

public bool IncludeHeaders { get; set; }

Property Value

bool

true to include headers; otherwise, false. The default is true.

RedactedHeaders

Gets headers whose values are replaced with {Redacted}.

public ISet<string> RedactedHeaders { get; }

Property Value

ISet<string>

The live, options-owned case-insensitive set. The default set is empty.

Methods

IgnoringHeaders(params string[])

Excludes response headers and returns this instance.

public StubHttpResponseSnapshotOptions IgnoringHeaders(params string[] headerNames)

Parameters

headerNames string[]

The non-null array of non-empty, case-insensitive names to exclude. An empty array is a no-op. Values are copied into the ignored set and removed from the redacted set.

Returns

StubHttpResponseSnapshotOptions

This options instance so additional settings can be configured.

IncludingHeader(string)

Includes a response header that was excluded by default.

public StubHttpResponseSnapshotOptions IncludingHeader(string headerName)

Parameters

headerName string

The non-empty, case-insensitive name to remove from both the ignored and redacted sets.

Returns

StubHttpResponseSnapshotOptions

This options instance so additional settings can be configured.

RedactingHeader(string)

Redacts a response header value while preserving the header.

public StubHttpResponseSnapshotOptions RedactingHeader(string headerName)

Parameters

headerName string

The non-empty, case-insensitive name to include with every value replaced by {Redacted}.

Returns

StubHttpResponseSnapshotOptions

This options instance so additional settings can be configured.

RedactingHeaders(params string[])

Redacts response header values while preserving the headers.

public StubHttpResponseSnapshotOptions RedactingHeaders(params string[] headerNames)

Parameters

headerNames string[]

The non-null array of non-empty, case-insensitive names to include with values replaced by {Redacted}. An empty array is a no-op. Values are removed from the ignored set.

Returns

StubHttpResponseSnapshotOptions

This options instance so additional settings can be configured.

WithoutBody()

Excludes response content and returns this instance.

public StubHttpResponseSnapshotOptions WithoutBody()

Returns

StubHttpResponseSnapshotOptions

This options instance so additional settings can be configured.

WithoutHeaders()

Excludes response headers and returns this instance.

public StubHttpResponseSnapshotOptions WithoutHeaders()

Returns

StubHttpResponseSnapshotOptions

This options instance so additional settings can be configured.