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

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

RegisterClientName(IProtoApplicationBuilder?, string, string?)

The first step every protocol's AddClient shares: default the client name, qualify it with the application and record it there, so the application knows its clients and the names never collide.

public static (string ClientName, string RegisteredName, string? ApplicationName) RegisterClientName(IProtoApplicationBuilder? application, string protocolName, string? name)

Parameters

application IProtoApplicationBuilder
protocolName string
name string

Returns

(string ClientName, string RegisteredName, string ApplicationName)