Class StubHttpResponse
- Namespace
- XBullet.EasyTesting.Http
- Assembly
- XBullet.EasyTesting.Http.dll
A captured outbound HTTP response.
public sealed record StubHttpResponse : IEquatable<StubHttpResponse>
- Inheritance
-
StubHttpResponse
- Implements
- Inherited Members
Constructors
StubHttpResponse(int, string?, IReadOnlyDictionary<string, string[]>, bool, ReadOnlyMemory<byte>, StubHttpFailure?)
A captured outbound HTTP response.
public StubHttpResponse(int StatusCode, string? ReasonPhrase, IReadOnlyDictionary<string, string[]> Headers, bool BodyCaptured, ReadOnlyMemory<byte> Body, StubHttpFailure? BodyFailure)
Parameters
StatusCodeintThe numeric HTTP status code returned by the stub.
ReasonPhrasestringThe optional HTTP reason phrase, or null when none was supplied.
HeadersIReadOnlyDictionary<string, string[]>A case-insensitive snapshot of response and content headers. The exchange owns the dictionary and nested arrays; callers must not mutate them.
BodyCapturedbooltrue when the response has no content or content consumption has completed or failed; otherwise, false.
BodyReadOnlyMemory<byte>The response bytes captured during content consumption. Before consumption this is empty; after a failed read it contains the bytes written before failure. The exchange owns the memory.
BodyFailureStubHttpFailureA stable description of the content-consumption failure, or null when content has not been consumed or was consumed successfully.
Properties
Body
The response bytes captured during content consumption. Before consumption this is empty; after a failed read it contains the bytes written before failure. The exchange owns the memory.
public ReadOnlyMemory<byte> Body { get; init; }
Property Value
BodyCaptured
true when the response has no content or content consumption has completed or failed; otherwise, false.
public bool BodyCaptured { get; init; }
Property Value
BodyFailure
A stable description of the content-consumption failure, or null when content has not been consumed or was consumed successfully.
public StubHttpFailure? BodyFailure { get; init; }
Property Value
Headers
A case-insensitive snapshot of response and content headers. The exchange owns the dictionary and nested arrays; callers must not mutate them.
public IReadOnlyDictionary<string, string[]> Headers { get; init; }
Property Value
ReasonPhrase
The optional HTTP reason phrase, or null when none was supplied.
public string? ReasonPhrase { get; init; }
Property Value
StatusCode
The numeric HTTP status code returned by the stub.
public int StatusCode { get; init; }