public sealed class HttpClientFromMessageHandlerFactory : IHttpClientFactory
An implementation of IHttpClientFactory that allows for the inner message handler to be injected.
Implements
IHttpClientFactoryNamespace
Google.Apis.HttpAssembly
Google.Apis.Core.dll
Constructors
HttpClientFromMessageHandlerFactory(Func<HttpClientFromMessageHandlerFactory.HttpMessageHandlerOptions, HttpClientFromMessageHandlerFactory.ConfiguredHttpMessageHandler>)
public HttpClientFromMessageHandlerFactory(Func<HttpClientFromMessageHandlerFactory.HttpMessageHandlerOptions, HttpClientFromMessageHandlerFactory.ConfiguredHttpMessageHandler> httpMessageHandlerFactory)
Creates an HttpClientFromMessageHandlerFactory that will use the given HttpMessageHandler factory for creating the inner message handlers that will be used when creating the ConfigurableHttpClient.
Parameter | |
---|---|
Name | Description |
httpMessageHandlerFactory | Func<HttpClientFromMessageHandlerFactory.HttpMessageHandlerOptions, HttpClientFromMessageHandlerFactory.ConfiguredHttpMessageHandler> |
The HttpMessageHandler obtained from the factory won't be disposed when the created ConfigurableHttpClient is. This allows calling code to control the handlers' lifetime and so they can possibly be reused. This may be a requirement for using System.Net.Http.IHttpMessageHandler. See https://docs.microsoft.com/en-us/dotnet/architecture/microservices/implement-resilient-applications/use-httpclientfactory-to-implement-resilient-http-requests for information on why to use System.Net.Http.IHttpMessageHandler.
Methods
CreateHttpClient(CreateHttpClientArgs)
public ConfigurableHttpClient CreateHttpClient(CreateHttpClientArgs args)
Creates a new configurable HTTP client.
Parameter | |
---|---|
Name | Description |
args | CreateHttpClientArgs |
Returns | |
---|---|
Type | Description |
ConfigurableHttpClient |