HttpManagerOptions Class
Definition
Specifies options that is related to the HttpManager class.
public class HttpManagerOptions : IValidatableParameterObject, IParameterObject
- Inheritance
-
HttpManagerOptions
- Implements
Examples
The following example demonstrates how to configure
using System;
using System.Net.Http;
using Cuemon.Net.Http;
namespace MyApp.Examples;
public static class HttpManagerOptionsExample
{
public static void Demonstrate()
{
var options = new HttpManagerOptions
{
Timeout = TimeSpan.FromSeconds(10),
HandlerFactory = () => new HttpClientHandler(),
DefaultRequestHeaders =
{
["X-Correlation-Id"] = "docs-123"
}
};
options.ValidateOptions();
Console.WriteLine(options.Timeout.TotalSeconds);
Console.WriteLine(options.DefaultRequestHeaders["X-Correlation-Id"]);
}
}
Constructors
| Name | Description |
|---|---|
| HttpManagerOptions() | Initializes a new instance of the HttpManagerOptions class. |
Properties
| Name | Description |
|---|---|
| DefaultRequestHeaders | Gets or sets the default headers which should be sent with each request. |
| DisposeHandler | Gets or sets a value indicating whether the inner handler should be disposed of by Dispose(). |
| HandlerFactory | Gets or sets the HTTP handler stack to use for sending requests. |
| Timeout | Gets or sets the timespan to wait before the request times out. Default is 2 minutes. |
Methods
| Name | Description |
|---|---|
| ValidateOptions() | Determines whether the public read-write properties of this instance are in a valid state. |