Skip to content

WebhookHttpClient

Namespace AgentPrism · Assembly AgentPrism.Core.dll

Provides the HttpClient used for webhook delivery, with built-in SSRF protection.

public sealed class WebhookHttpClient : IDisposable

objectWebhookHttpClient

IDisposable

object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Protection is built into the client itself, not caller code. A single path that accidentally used an unprotected HttpClient would defeat the entire defense. This type does not accept an external Http.HttpMessageHandler; an internal constructor exists only for tests.

IHttpClientFactory is not used because it would add Microsoft.Extensions.Http to the dependency graph, and a consumer could reconfigure the factory and remove the protection.

WebhookHttpClient(IOptionsMonitor<AgentPrismWebhookOptions>, IOptionsMonitor<AgentPrismEgressOptions>)

Section titled “ WebhookHttpClient(IOptionsMonitor<AgentPrismWebhookOptions>, IOptionsMonitor<AgentPrismEgressOptions>)”

Initializes the production client.

public WebhookHttpClient(IOptionsMonitor<AgentPrismWebhookOptions> optionsMonitor, IOptionsMonitor<AgentPrismEgressOptions> egressOptions)

optionsMonitor IOptionsMonitor<AgentPrismWebhookOptions>

The webhook options.

egressOptions IOptionsMonitor<AgentPrismEgressOptions>

The shared egress options.

ArgumentNullException

optionsMonitor or egressOptions is null.

public void Dispose()

SendAsync(HttpRequestMessage, TimeSpan, CancellationToken)

Section titled “ SendAsync(HttpRequestMessage, TimeSpan, CancellationToken)”

Sends a request.

public Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, TimeSpan timeout, CancellationToken cancellationToken = default)

request HttpRequestMessage

The request.

timeout TimeSpan

The timeout specific to this request.

cancellationToken CancellationToken

The cancellation token.

Task<HttpResponseMessage>

The response.

ArgumentNullException

request is null.