Class StubHttpRequestSnapshot
- Namespace
- XBullet.EasyTesting.Snapshots
- Assembly
- XBullet.EasyTesting.Snapshots.Http.dll
A stable representation of one captured outbound HTTP request.
public sealed record StubHttpRequestSnapshot : IEquatable<StubHttpRequestSnapshot>
- Inheritance
-
StubHttpRequestSnapshot
- Implements
- Inherited Members
Constructors
StubHttpRequestSnapshot(string, string?, IReadOnlyDictionary<string, string[]>?, object?)
A stable representation of one captured outbound HTTP request.
public StubHttpRequestSnapshot(string Method, string? Url, IReadOnlyDictionary<string, string[]>? Headers, object? Body)
Parameters
MethodstringThe HTTP method text captured from the request.
UrlstringThe relative path, query, and fragment after configured scrubbing, or null when the request had no URI.
HeadersIReadOnlyDictionary<string, string[]>The sorted, copied header snapshot, or null when headers were excluded. Ignored headers are absent and redacted values are represented by
{Redacted}.BodyobjectA cloned JsonElement for valid JSON content, the original text for other non-empty content, or null when the body is absent, empty, or excluded.
Properties
Body
A cloned JsonElement for valid JSON content, the original text for other non-empty content, or null when the body is absent, empty, or excluded.
public object? Body { get; init; }
Property Value
Headers
The sorted, copied header snapshot, or null when headers were excluded.
Ignored headers are absent and redacted values are represented by {Redacted}.
public IReadOnlyDictionary<string, string[]>? Headers { get; init; }
Property Value
Method
The HTTP method text captured from the request.
public string Method { get; init; }
Property Value
Url
The relative path, query, and fragment after configured scrubbing, or null when the request had no URI.
public string? Url { get; init; }
Property Value
Methods
FromRequest(StubHttpRequest, StubHttpRequestSnapshotOptions?)
Creates a deterministic snapshot model from a captured request.
public static StubHttpRequestSnapshot FromRequest(StubHttpRequest request, StubHttpRequestSnapshotOptions? options = null)
Parameters
requestStubHttpRequestThe non-null captured request to read. The method does not own, retain, or mutate it.
optionsStubHttpRequestSnapshotOptionsInclusion, redaction, and scrubbing settings to read, or null to use a new default options instance. The method does not retain, own, or mutate supplied options; configured path scrubbers run synchronously before it returns.
Returns
- StubHttpRequestSnapshot
A new stable request snapshot that owns its copied headers and normalized body value.