Show / Hide Table of Contents

Class HttpClientFromMessageHandlerFactory

An implementation of IHttpClientFactory that allows for the inner message handler to be injected.

Inheritance
object
HttpClientFromMessageHandlerFactory
Implements
IHttpClientFactory
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Google.Apis.Http
Assembly: Google.Apis.Core.dll
Syntax
public sealed class HttpClientFromMessageHandlerFactory : IHttpClientFactory

Constructors

HttpClientFromMessageHandlerFactory(Func<HttpMessageHandlerOptions, ConfiguredHttpMessageHandler>)

Creates an HttpClientFromMessageHandlerFactory that will use the given 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
Func<HttpClientFromMessageHandlerFactory.HttpMessageHandlerOptions, HttpClientFromMessageHandlerFactory.ConfiguredHttpMessageHandler> httpMessageHandlerFactory
Remarks

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)

Creates a new configurable HTTP client.

Declaration
public ConfigurableHttpClient CreateHttpClient(CreateHttpClientArgs args)
Parameters
Type Name Description
CreateHttpClientArgs args
Returns
Type Description
ConfigurableHttpClient

Implements

IHttpClientFactory

Extension Methods

Utilities.ThrowIfNull<T>(T, string)
In this article
Back to top Generated by DocFX