Table of Contents

HttpWatcherOptions Class

Definition

Namespace
Cuemon.Net.Http
Assemblies
Cuemon.Net.dll
Source
src/Cuemon.Net/Http/HttpWatcherOptions.cs

Configuration options for HttpWatcher.

public class HttpWatcherOptions : WatcherOptions, IValidatableParameterObject, IParameterObject
Inheritance
HttpWatcherOptions
Implements
Inherited Members

Examples

The following example demonstrates how to configure before creating an .

using System;
using System.Net.Http;
using Cuemon.Net.Http;
using Cuemon.Security;

namespace MyApp.Examples;

public static class HttpWatcherOptionsExample
{
    public static void Demonstrate()
    {
        var options = new HttpWatcherOptions
        {
            ClientFactory = () => new HttpClient(new HttpClientHandler(), false),
            HashFactory = () => new CyclicRedundancyCheck64(),
            ReadResponseBody = true,
            Period = TimeSpan.FromSeconds(5)
        };

        options.ValidateOptions();

        Console.WriteLine(options.ReadResponseBody);
        Console.WriteLine(options.Period.TotalSeconds);
        Console.WriteLine($"HTTP client factory configured: {options.ClientFactory is not null}");
    }
}

Constructors

Name Description
HttpWatcherOptions()

Initializes a new instance of the HttpWatcherOptions class.

Properties

Name Description
ClientFactory

Gets or sets the function delegate that will resolve an instance of HttpClient.

HashFactory

Gets or sets the function delegate that will resolve an implementation of Hash.

ReadResponseBody

Gets or sets a value indicating whether to compute a hash from the response data of the HttpWatcher.

Methods

Name Description
ValidateOptions()

Determines whether the public read-write properties of this instance are in a valid state.