Class HttpClientFromMessageHandlerFactory
An implementation of IHttpClientFactory that allows for the inner message handler to be injected.
Inheritance
Implements
Inherited Members
Namespace: Google.Apis.Http
Assembly: Google.Apis.Core.dll
Syntax
public sealed class HttpClientFromMessageHandlerFactory : IHttpClientFactory
Constructors
HttpClientFromMessageHandlerFactory(Func<HttpClientFromMessageHandlerFactory.HttpMessageHandlerOptions, HttpClientFromMessageHandlerFactory.ConfiguredHttpMessageHandler>)
Creates an HttpClientFromMessageHandlerFactory that will use the given System.Net.Http.HttpMessageHandler factory for creating the inner message handlers that will be used when creating the ConfigurableHttpClient.
Declaration
public HttpClientFromMessageHandlerFactory(Func<HttpClientFromMessageHandlerFactory.HttpMessageHandlerOptions, HttpClientFromMessageHandlerFactory.ConfiguredHttpMessageHandler> httpMessageHandlerFactory)
Parameters
Type | Name | Description |
---|---|---|
System.Func<HttpClientFromMessageHandlerFactory.HttpMessageHandlerOptions, HttpClientFromMessageHandlerFactory.ConfiguredHttpMessageHandler> | httpMessageHandlerFactory |
Remarks
The System.Net.Http.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)
Creates a new configurable HTTP client.
Declaration
public ConfigurableHttpClient CreateHttpClient(CreateHttpClientArgs args)
Parameters
Type | Name | Description |
---|---|---|
CreateHttpClientArgs | args |
Returns
Type | Description |
---|---|
ConfigurableHttpClient |