Class ProtoHttpClientInitializer
Initializes a named HTTP client from an explicit URL, or from the application the target belongs to: the application's base address, optionally combined with one of its named endpoint paths.
public sealed class ProtoHttpClientInitializer : IProtoClientInitializer<HttpClient>, IProtoClientInitializer
- Inheritance
-
ProtoHttpClientInitializer
- Implements
- Inherited Members
- Extension Methods
Constructors
ProtoHttpClientInitializer(string, string, string?, bool, string?, string?)
Initializes a named HTTP client from an explicit URL, or from the application the target belongs to: the application's base address, optionally combined with one of its named endpoint paths.
public ProtoHttpClientInitializer(string protocolName, string name, string? explicitBaseUrl = null, bool allowMissingBaseUrl = false, string? application = null, string? endpoint = null)
Parameters
protocolNamestringnamestringexplicitBaseUrlstringallowMissingBaseUrlboolapplicationstringendpointstring
Properties
Name
Gets the registration name for this client (e.g., "Default", "OrderService"). Initializers with the same name and ClientType form an ordered provider chain.
public string Name { get; }
Property Value
Methods
GetFactoryName(string, string)
public static string GetFactoryName(string protocolName, string clientName)
Parameters
Returns
TryInitializeAsync(ProtoExecutionContext, CancellationToken)
Attempts to build and register the client into the specified test execution context. Returns false without changing the context when this initializer cannot provide the client for the current configuration.
public Task<bool> TryInitializeAsync(ProtoExecutionContext context, CancellationToken cancellationToken = default)
Parameters
contextProtoExecutionContextcancellationTokenCancellationToken