Class ShieldHttpHandlerOptions

Namespace
Kevlar.Extensions.Http
Assembly
Kevlar.Extensions.Http.dll

Configures safe request replay and optional endpoint routing.

public sealed class ShieldHttpHandlerOptions
Inheritance
ShieldHttpHandlerOptions
Inherited Members

Remarks

Values are snapshotted when the handler pipeline is registered or created. Later mutations do not reconfigure that pipeline; use a configuration-backed reloading registration for updates.

Constructors

ShieldHttpHandlerOptions()

public ShieldHttpHandlerOptions()

Properties

AllowUnsafeMethodReplay

Explicitly permits another attempt for methods rejected by IsReplaySafeMethod. A request factory also counts as explicit opt-in. Content must still be replayable.

public bool AllowUnsafeMethodReplay { get; set; }

Property Value

bool

ContentReplayPolicy

The request-content replay policy. The default never buffers caller content.

public HttpContentReplayPolicy ContentReplayPolicy { get; set; }

Property Value

HttpContentReplayPolicy

IsReplaySafeMethod

Optionally determines whether an HTTP method permits additional attempts. A null value uses GET, HEAD, OPTIONS, TRACE, PUT, and DELETE, the RFC 9110 idempotent methods.

public Func<HttpMethod, bool>? IsReplaySafeMethod { get; set; }

Property Value

Func<HttpMethod, bool>

Remarks

The predicate may run concurrently and must be thread-safe. Explicit replay opt-ins bypass it; per-request DisableReplay(HttpRequestMessage) always takes precedence. Content must still be replayable when the predicate returns true.

MaxBufferSize

The maximum buffered request-content size. Defaults to 1 MiB.

public long MaxBufferSize { get; set; }

Property Value

long

RequestFactory

Optionally creates a fresh complete request for each zero-based attempt. Returned requests are owned and disposed by the handler; returning the original request preserves caller ownership.

public Func<HttpRequestMessage, int, CancellationToken, ValueTask<HttpRequestMessage>>? RequestFactory { get; set; }

Property Value

Func<HttpRequestMessage, int, CancellationToken, ValueTask<HttpRequestMessage>>

Routing

Optional alternate-authority routing.

public HttpEndpointRoutingOptions? Routing { get; set; }

Property Value

HttpEndpointRoutingOptions

Methods

Clone()

Creates a copy with independent nested configuration objects.

public ShieldHttpHandlerOptions Clone()

Returns

ShieldHttpHandlerOptions

A new options instance with copied configuration containers.

Remarks

Delegates and runtime collaborators, such as retry budgets and circuit monitors, retain their references. Captured delegate state and collaborator state are not cloned.