Class FakeHttpMessageHandler
A HttpMessageHandler that retrieves http response messages from an alternate storage rather than from a given http endpoint
Inherited Members
Namespace: FakeHttp
Assembly: FakeHttp.dll
Syntax
public sealed class FakeHttpMessageHandler : HttpMessageHandler, IDisposable
Constructors
| Improve this Doc View SourceFakeHttpMessageHandler(IReadOnlyResources)
ctor
Declaration
public FakeHttpMessageHandler(IReadOnlyResources resources)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyResources | resources | An object that can access stored response |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
FakeHttpMessageHandler(IReadOnlyResponseStore)
ctor
Declaration
public FakeHttpMessageHandler(IReadOnlyResponseStore store)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyResponseStore | store | The storage mechanism for responses |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
Methods
| Improve this Doc View SourceSendAsync(HttpRequestMessage, CancellationToken)
Override the base class to skip http and retrieve message from storage
Declaration
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
HttpRequestMessage | request | |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> | The stored response message |