1.73.0 (latest) 1.69.0 1.68.0 1.60.0 1.59.0 1.55.0 1.50.0

    public sealed class HttpClientFromMessageHandlerFactory : IHttpClientFactory

An implementation of [IHttpClientFactory](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.IHttpClientFactory.md.txt) that allows
for the inner message handler to be injected.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> HttpClientFromMessageHandlerFactory

## Implements

[IHttpClientFactory](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.IHttpClientFactory.md.txt)

## Inherited Members

[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)) [object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) [object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

[Google.Apis.Http](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.md.txt)

## Assembly

Google.Apis.Core.dll

## Constructors

### HttpClientFromMessageHandlerFactory(Func\<HttpMessageHandlerOptions, ConfiguredHttpMessageHandler\>)

    public HttpClientFromMessageHandlerFactory(Func<HttpClientFromMessageHandlerFactory.HttpMessageHandlerOptions, HttpClientFromMessageHandlerFactory.ConfiguredHttpMessageHandler> httpMessageHandlerFactory)

Creates an [HttpClientFromMessageHandlerFactory](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.HttpClientFromMessageHandlerFactory.md.txt) that will use
the given [HttpMessageHandler](https://learn.microsoft.com/dotnet/api/system.net.http.httpmessagehandler) factory for creating the inner
message handlers that will be used when creating the [ConfigurableHttpClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.ConfigurableHttpClient.md.txt).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `httpMessageHandlerFactory` | `FuncHttpClientFromMessageHandlerFactoryHttpMessageHandlerOptionsHttpClientFromMessageHandlerFactoryConfiguredHttpMessageHandler` |

**Remarks** The [HttpMessageHandler](https://learn.microsoft.com/dotnet/api/system.net.http.httpmessagehandler) obtained from the factory won't be disposed
when the created [ConfigurableHttpClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.ConfigurableHttpClient.md.txt) 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` |   |

## Extension Method

[Utilities.ThrowIfNull\<T\>(T, string)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Util.Utilities.md.txt#Google_Apis_Util_Utilities_ThrowIfNull__1___0_System_String_)