HttpClientBuilder class

Fluent builder used to configure named HTTP clients.

Constructors

HttpClientBuilder(ServiceCollection services, String name)

Properties

hashCode → int
The hash code for this object.
no setterinherited
name → String
The logical name of the client.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
services → ServiceCollection
The service collection the client is registered with.
final

Methods

addAsKeyed({ServiceLifetime lifetime = ServiceLifetime.scoped}) → HttpClientBuilder
Registers this named client as a keyed http.BaseClient service with the client name as the service key.
addHttpMessageHandler(HttpMessageHandler handlerFactory(ServiceProvider services)) → HttpClientBuilder
Adds a delegating handler to the pipeline.
addTypedClient<TClient extends Object>(TClient factory(BaseClient client, ServiceProvider services)) → HttpClientBuilder
Registers a typed client that depends on this named client.
configureAdditionalHttpMessageHandlers(void configure(List<DelegatingHandler> handlers, ServiceProvider services)) → HttpClientBuilder
Adds a delegate that mutates the list of additional handlers after all other handler configuration has run.
configureHttpClient(void configure(BaseClient client, ServiceProvider services)) → HttpClientBuilder
Adds an action to configure the outgoing client instance.
configureHttpMessageHandlerBuilder(HttpMessageHandlerBuilderAction configure) → HttpClientBuilder
Adds a delegate to mutate the handler pipeline.
configurePrimaryHttpMessageHandler(HttpMessageHandler factory(ServiceProvider services)) → HttpClientBuilder
Sets the primary handler for the client.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
redactLoggedHeaderNames(List<String> headerNames) → HttpClientBuilder
Configures specific header names to be redacted in logs.
redactLoggedHeaders(bool shouldRedact(String headerName)) → HttpClientBuilder
Configures the header redaction for this HTTP client.
removeAsKeyed() → HttpClientBuilder
Removes the keyed http.BaseClient registration for this client name, if present.
setHandlerLifetime(Duration lifetime) → HttpClientBuilder
Sets the handler lifetime for this HTTP client.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited