Class StubHttpResponseSnapshot
- Namespace
- XBullet.EasyTesting.Snapshots
- Assembly
- XBullet.EasyTesting.Snapshots.Http.dll
A stable representation of one captured outbound HTTP response.
public sealed class StubHttpResponseSnapshot
- Inheritance
-
StubHttpResponseSnapshot
- Inherited Members
Properties
Body
Gets the normalized response body.
public object? Body { get; }
Property Value
- object
{NotRead}when content was not consumed; a cloned JsonElement for valid JSON; a string for text or malformed JSON; a base64 ControllerBinaryBodySnapshot for binary data; or null when the body is empty or excluded.
BodyFailure
Gets the failure raised while the response body was read.
public StubHttpFailureSnapshot? BodyFailure { get; }
Property Value
- StubHttpFailureSnapshot
The stable content-read failure, or null when no failure was captured. Failure messages are copied without automatic redaction.
Headers
Gets the normalized response headers.
public IReadOnlyDictionary<string, string[]>? Headers { get; }
Property Value
- IReadOnlyDictionary<string, string[]>
The sorted, copied header snapshot, or null when headers were excluded. Ignored headers are absent and redacted values are represented by
{Redacted}.
ReasonPhrase
Gets the HTTP reason phrase.
public string? ReasonPhrase { get; }
Property Value
StatusCode
Gets the numeric HTTP status code.
public int StatusCode { get; }
Property Value
- int
The integer status code copied from the captured response.
Methods
FromResponse(StubHttpResponse, StubHttpResponseSnapshotOptions?)
Creates a deterministic snapshot model from a captured response.
public static StubHttpResponseSnapshot FromResponse(StubHttpResponse response, StubHttpResponseSnapshotOptions? options = null)
Parameters
responseStubHttpResponseThe non-null captured response to read. The method does not own, retain, or mutate it.
optionsStubHttpResponseSnapshotOptionsHeader and body inclusion settings to read, or null to use a new default options instance. The method does not retain, own, or mutate supplied options.
Returns
- StubHttpResponseSnapshot
A new stable response snapshot that owns its copied headers, normalized body value, and failure description.