Definition
Assembly: CloudNimble.Breakdance.Assemblies.dll
Namespace: CloudNimble.Breakdance.Assemblies.Http
Inheritance: CloudNimble.Breakdance.Assemblies.Http.ResponseSnapshotCaptureHandler
Syntax
CloudNimble.Breakdance.Assemblies.Http.TestCacheWriteDelegatingHandler
Summary
Handler for capturing HTTP responses and writing them to files.
This class is deprecated. Use ResponseSnapshotCaptureHandler instead.
Constructors
.ctor
Creates a new TestCacheWriteDelegatingHandler with the specified root folder path.
Syntax
public TestCacheWriteDelegatingHandler(string responseFilesPath)
Parameters
| Name | Type | Description |
|---|
responseFilesPath | string | Root folder path for storing static response files. |
This constructor is deprecated. Use ResponseSnapshotCaptureHandler instead.
.ctor Inherited
Inherited from CloudNimble.Breakdance.Assemblies.Http.ResponseSnapshotCaptureHandler
Creates a new ResponseSnapshotCaptureHandler that saves response snapshots to the specified path.
Syntax
public ResponseSnapshotCaptureHandler(string responseSnapshotsPath)
Parameters
| Name | Type | Description |
|---|
responseSnapshotsPath | string | Root folder path for storing response snapshot files. |
.ctor Inherited
Inherited from CloudNimble.Breakdance.Assemblies.Http.ResponseSnapshotHandlerBase
Creates a new ResponseSnapshotHandlerBase with the specified snapshot storage path.
Syntax
public ResponseSnapshotHandlerBase(string responseSnapshotsPath)
Parameters
| Name | Type | Description |
|---|
responseSnapshotsPath | string | Root folder path for storing response snapshot files. |
Examples
var handler = new ResponseSnapshotReplayHandler("TestData/Snapshots");
var client = new HttpClient(handler);
Properties
ResponseSnapshotsPath Inherited
Inherited from CloudNimble.Breakdance.Assemblies.Http.ResponseSnapshotHandlerBase
Gets the root folder path where response snapshot files are stored.
Syntax
public string ResponseSnapshotsPath { get; private set; }
Property Value
Type: string
Methods
GetFileExtensionString Inherited
Inherited from CloudNimble.Breakdance.Assemblies.Http.ResponseSnapshotHandlerBase
Maps the MediaType header in the HttpRequestMessage to a known list of file extensions.
Syntax
public static string GetFileExtensionString(System.Net.Http.HttpRequestMessage request)
Parameters
| Name | Type | Description |
|---|
request | System.Net.Http.HttpRequestMessage | The request to examine. |
Returns
Type: string
The file extension string for the request’s Accept header.
Exceptions
| Exception | Description |
|---|
ArgumentNullException | Thrown when request is null. |
GetPathInfo Inherited
Inherited from CloudNimble.Breakdance.Assemblies.Http.ResponseSnapshotHandlerBase
Parses the RequestUri in the HttpRequestMessage into a Path-safe string
suitable for storing response snapshots on the file system.
Syntax
internal static (string, string) GetPathInfo(System.Net.Http.HttpRequestMessage request, string responseSnapshotsPath)
Parameters
| Name | Type | Description |
|---|
request | System.Net.Http.HttpRequestMessage | The HttpRequestMessage to parse. |
responseSnapshotsPath | string | Root folder for storing snapshot files. |
Returns
Type: (string, string)
A tuple containing the directory path and file path components.
Exceptions
| Exception | Description |
|---|
ArgumentException | Thrown when the request has an invalid RequestUri. |
InvalidOperationException | Thrown when the URI cannot be converted to a valid file path. |
Inherited from CloudNimble.Breakdance.Assemblies.Http.ResponseSnapshotHandlerBase
Maps the file extension in the specified path to a known list of media types.
Syntax
public static string GetResponseMediaTypeString(string filePath)
Parameters
| Name | Type | Description |
|---|
filePath | string | The file path to examine. |
Returns
Type: string
The MIME type string for the file extension.
SendAsync Override
Inherited from CloudNimble.Breakdance.Assemblies.Http.ResponseSnapshotCaptureHandler
Sends the request to the actual endpoint and captures the response as a snapshot file.
Syntax
protected override System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> SendAsync(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken)
Parameters
| Name | Type | Description |
|---|
request | System.Net.Http.HttpRequestMessage | The HttpRequestMessage being intercepted. |
cancellationToken | System.Threading.CancellationToken | Token for cancelling the asynchronous operation. |
Returns
Type: System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
The HttpResponseMessage from the actual endpoint.
Exceptions
| Exception | Description |
|---|
ArgumentNullException | Thrown when request is null. |
SendAsyncInternal Inherited
Inherited from CloudNimble.Breakdance.Assemblies.Http.ResponseSnapshotCaptureHandler
Allows test projects to call the otherwise inaccessible CancellationToken) method directly.
Syntax
internal System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> SendAsyncInternal(System.Net.Http.HttpRequestMessage request)
Parameters
| Name | Type | Description |
|---|
request | System.Net.Http.HttpRequestMessage | The HttpRequestMessage to process. |
Returns
Type: System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
The HttpResponseMessage from the actual endpoint.