HttpExceptionDescriptorResponseHandlerOptions Class
Definition
- Namespace
- Cuemon.AspNetCore.Diagnostics
- Assemblies
- Cuemon.AspNetCore.dll
Specifies options that is related to HttpExceptionDescriptorResponseHandler operations.
public class HttpExceptionDescriptorResponseHandlerOptions : IValidatableParameterObject, IParameterObject
- Inheritance
-
HttpExceptionDescriptorResponseHandlerOptions
- Implements
Examples
The following example demonstrates response handler options for HTTP exception descriptors.
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
namespace Cuemon.AspNetCore.Diagnostics;
public static class HttpExceptionDescriptorResponseHandlerOptionsExample
{
public static void Demonstrate()
{
var options = new HttpExceptionDescriptorResponseHandlerOptions
{
ContentType = new MediaTypeHeaderValue("text/plain"),
ContentFactory = exceptionDescriptor => new StringContent(exceptionDescriptor.Message),
StatusCodeFactory = exceptionDescriptor => (HttpStatusCode)exceptionDescriptor.StatusCode
};
options.ValidateOptions();
}
}
Constructors
| Name | Description |
|---|---|
| HttpExceptionDescriptorResponseHandlerOptions() | Initializes a new instance of the HttpExceptionDescriptorResponseHandlerOptions class. |
Properties
| Name | Description |
|---|---|
| ContentFactory | Gets or sets the function delegate that will create an instance of HttpContent with input from the specified HttpExceptionDescriptor. |
| ContentType | Gets or sets the supported media-type of the response. |
| StatusCodeFactory | Gets or sets the function delegate that will return a HttpStatusCode value with input from the specified HttpExceptionDescriptor. |
Methods
| Name | Description |
|---|---|
| ValidateOptions() | Determines whether the public read-write properties of this instance are in a valid state. |