Class ProtoHttpClientRegistration

Namespace
ProtoTest.Http
Assembly
ProtoTest.Http.dll

Registers the named HTTP client and initializer shared by every HTTP-based protocol's AddClient overloads, so each protocol only supplies its own display label and error text.

public static class ProtoHttpClientRegistration
Inheritance
ProtoHttpClientRegistration
Inherited Members

Methods

AddClient(IServiceCollection, string, string, Func<ProtoExecutionContext, CancellationToken, ValueTask<Uri>>, Action<IHttpClientBuilder>?, string?)

Registers a named HTTP client whose absolute base address is resolved from per-test context.

public static IProtoTargetBuilder AddClient(IServiceCollection services, string protocolName, string name, Func<ProtoExecutionContext, CancellationToken, ValueTask<Uri>> baseAddressResolver, Action<IHttpClientBuilder>? configure, string? application = null)

Parameters

services IServiceCollection
protocolName string
name string
baseAddressResolver Func<ProtoExecutionContext, CancellationToken, ValueTask<Uri>>
configure Action<IHttpClientBuilder>
application string

Returns

IProtoTargetBuilder

AddClient(IServiceCollection, string, string, string, string?, Action<IHttpClientBuilder>?, string?, string?, bool)

Registers a named HTTP client with an explicit or application-resolved base URL.

public static IProtoTargetBuilder AddClient(IServiceCollection services, string protocolName, string protocolLabel, string name, string? baseUrl, Action<IHttpClientBuilder>? configure, string? application = null, string? endpoint = null, bool allowMissingBaseUrl = false)

Parameters

services IServiceCollection
protocolName string
protocolLabel string
name string
baseUrl string
configure Action<IHttpClientBuilder>
application string
endpoint string
allowMissingBaseUrl bool

Returns

IProtoTargetBuilder

AddClientFrom(IServiceCollection, string, string, string, string?, string?)

Registers a target whose transport comes from another HTTP client, such as one registered by an in-process ASP.NET Core server, optionally rooted at a path. Every HTTP-based protocol's AddClientFrom overload uses this so aliasing behaves identically.

public static IProtoTargetBuilder AddClientFrom(IServiceCollection services, string protocolName, string name, string sourceClientName, string? basePath = null, string? application = null)

Parameters

services IServiceCollection
protocolName string
name string
sourceClientName string
basePath string
application string

Returns

IProtoTargetBuilder

Qualify(string, string?)

Qualifies a client name with its application, so per-application clients never collide.

public static string Qualify(string name, string? applicationName)

Parameters

name string
applicationName string

Returns

string