Class StubHttpRequestSnapshotOptions
- Namespace
- XBullet.EasyTesting.Snapshots
- Assembly
- XBullet.EasyTesting.Snapshots.Http.dll
Controls which outbound HTTP request details are included in snapshots.
public sealed class StubHttpRequestSnapshotOptions
- Inheritance
-
StubHttpRequestSnapshotOptions
- Inherited Members
Remarks
This mutable options object is not thread-safe. Its sets and path scrubbers remain live and are read each time a snapshot is created.
Properties
IgnoredHeaders
Gets headers excluded from snapshots. Credentials and volatile tracing headers are excluded by default. Header names are matched without regard to case.
public ISet<string> IgnoredHeaders { get; }
Property Value
- ISet<string>
The live, options-owned set of excluded header names. By default it contains
Authorization,Cookie,Proxy-Authorization,Request-Id,Traceparent,X-Api-Key, andX-Correlation-Id.
IncludeBody
Gets or sets whether request content is included.
public bool IncludeBody { get; set; }
Property Value
IncludeHeaders
Gets or sets whether request headers are included.
public bool IncludeHeaders { get; set; }
Property Value
RedactedHeaders
Gets headers whose presence is captured while their values are replaced with
{Redacted}. Header names are matched without regard to case.
public ISet<string> RedactedHeaders { get; }
Property Value
RedactedQueryParameters
Gets query parameters whose values are replaced with {Redacted}.
Names are matched without regard to case.
public ISet<string> RedactedQueryParameters { get; }
Property Value
- ISet<string>
The live, options-owned set of security-sensitive query names. The defaults include common token, key, password, secret, signature, code, and SAS parameter names.
ScrubbedQueryParameters
Gets query parameters whose values are replaced with {Scrubbed}. Names are matched
without regard to case. Security redaction takes precedence when a name appears in both
query-parameter sets.
public ISet<string> ScrubbedQueryParameters { get; }
Property Value
Methods
IgnoringHeaders(params string[])
Excludes headers and returns this instance.
public StubHttpRequestSnapshotOptions IgnoringHeaders(params string[] headerNames)
Parameters
headerNamesstring[]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
- StubHttpRequestSnapshotOptions
This options instance so additional settings can be configured.
IncludingHeader(string)
Includes a header that was excluded by default and returns this instance.
public StubHttpRequestSnapshotOptions IncludingHeader(string headerName)
Parameters
headerNamestringThe non-empty, case-insensitive name to remove from both the ignored and redacted sets.
Returns
- StubHttpRequestSnapshotOptions
This options instance so additional settings can be configured.
IncludingQueryParameter(string)
Includes the original value of a query parameter and returns this instance.
public StubHttpRequestSnapshotOptions IncludingQueryParameter(string parameterName)
Parameters
parameterNamestringThe non-empty, case-insensitive decoded query name to remove from both the redacted and scrubbed sets. Its original values can therefore appear in snapshots.
Returns
- StubHttpRequestSnapshotOptions
This options instance so additional settings can be configured.
RedactingHeader(string)
Redacts a header value while preserving the header and returns this instance.
public StubHttpRequestSnapshotOptions RedactingHeader(string headerName)
Parameters
headerNamestringThe non-empty, case-insensitive name to include with every value replaced by
{Redacted}.
Returns
- StubHttpRequestSnapshotOptions
This options instance so additional settings can be configured.
RedactingHeaders(params string[])
Redacts header values while preserving the headers and returns this instance.
public StubHttpRequestSnapshotOptions RedactingHeaders(params string[] headerNames)
Parameters
headerNamesstring[]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
- StubHttpRequestSnapshotOptions
This options instance so additional settings can be configured.
RedactingQueryParameter(string)
Redacts one query-parameter value and returns this instance.
public StubHttpRequestSnapshotOptions RedactingQueryParameter(string parameterName)
Parameters
parameterNamestringThe non-empty, case-insensitive decoded query name whose values are replaced by
{Redacted}.
Returns
- StubHttpRequestSnapshotOptions
This options instance so additional settings can be configured.
RedactingQueryParameters(params string[])
Redacts query-parameter values and returns this instance.
public StubHttpRequestSnapshotOptions RedactingQueryParameters(params string[] parameterNames)
Parameters
parameterNamesstring[]The non-null array of non-empty, case-insensitive decoded query names to redact. An empty array is a no-op. Values are copied into the redacted set and removed from the scrubbed set.
Returns
- StubHttpRequestSnapshotOptions
This options instance so additional settings can be configured.
ScrubbingQueryParameter(string)
Scrubs one volatile query-parameter value and returns this instance.
public StubHttpRequestSnapshotOptions ScrubbingQueryParameter(string parameterName)
Parameters
parameterNamestringThe non-empty, case-insensitive decoded query name whose values are replaced by
{Scrubbed}. Existing security redaction takes precedence.
Returns
- StubHttpRequestSnapshotOptions
This options instance so additional settings can be configured.
ScrubbingQueryParameters(params string[])
Scrubs volatile query-parameter values and returns this instance.
public StubHttpRequestSnapshotOptions ScrubbingQueryParameters(params string[] parameterNames)
Parameters
parameterNamesstring[]The non-null array of non-empty, case-insensitive decoded query names to scrub. An empty array is a no-op. Names already configured for redaction are not added.
Returns
- StubHttpRequestSnapshotOptions
This options instance so additional settings can be configured.
ScrubbingUrlPath(Func<string, string>)
Adds a transformation applied to the request URL path before it is snapshotted.
public StubHttpRequestSnapshotOptions ScrubbingUrlPath(Func<string, string> scrubber)
Parameters
scrubberFunc<string, string>The non-null callback retained and invoked in registration order with the URL path whenever a snapshot is created. It can run more than once and concurrently when the options are shared, must return a non-null path, and must not include secrets in thrown exceptions.
Returns
- StubHttpRequestSnapshotOptions
This options instance so additional settings can be configured.
ScrubbingUrlPathGuids()
Replaces complete GUID request-path segments with {Guid}.
public StubHttpRequestSnapshotOptions ScrubbingUrlPathGuids()
Returns
- StubHttpRequestSnapshotOptions
This options instance so additional settings can be configured.
WithoutBody()
Excludes request content and returns this instance.
public StubHttpRequestSnapshotOptions WithoutBody()
Returns
- StubHttpRequestSnapshotOptions
This options instance so additional settings can be configured.
WithoutHeaders()
Excludes request headers and returns this instance.
public StubHttpRequestSnapshotOptions WithoutHeaders()
Returns
- StubHttpRequestSnapshotOptions
This options instance so additional settings can be configured.