> ## Documentation Index
> Fetch the complete documentation index at: https://easyaf.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# IHttpClientBuilder

> Extension methods for IHttpClientBuilder from Microsoft.Extensions.Http

## Definition

**Assembly:** Microsoft.Extensions.Http.dll

**Namespace:** Microsoft.Extensions.DependencyInjection

## Syntax

```csharp theme={"dark"}
Microsoft.Extensions.DependencyInjection.IHttpClientBuilder
```

## Summary

This type is defined in Microsoft.Extensions.Http.

## Remarks

See [Microsoft documentation](https://learn.microsoft.com/dotnet/api/microsoft.extensions.dependencyinjection.ihttpclientbuilder) for more information about the rest of the API.

## Methods

### <Icon icon="puzzle-piece" iconType="duotone" color="#E0EC32" size={24} className="mr-2" /> AddHttpMessageHandler <Badge color="green">Extension</Badge>

<Note>Extension method from `Microsoft.Extensions.DependencyInjection.EasyAF_Http_IHttpClientBuilderExtensions`</Note>

Given the [HttpHandlerMode](/api-reference/CloudNimble/EasyAF/Core/HttpHandlerMode), adds the specified *THandler* to the beginning or end of the pipeline.

#### Syntax

```csharp theme={"dark"}
public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder AddHttpMessageHandler<THandler>(Microsoft.Extensions.DependencyInjection.IHttpClientBuilder builder, CloudNimble.EasyAF.Core.HttpHandlerMode mode) where THandler : System.Net.Http.DelegatingHandler
```

#### Parameters

| Name      | Type                                                          | Description                                                                                                                                                           |
| --------- | ------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `builder` | `Microsoft.Extensions.DependencyInjection.IHttpClientBuilder` | The [IHttpClientBuilder](/api-reference/Microsoft/Extensions/DependencyInjection/IHttpClientBuilder) instance to extend.                                              |
| `mode`    | `CloudNimble.EasyAF.Core.HttpHandlerMode`                     | A [HttpHandlerMode](/api-reference/CloudNimble/EasyAF/Core/HttpHandlerMode) specifying whether we are making this handler the first one in the pipeline, or the last. |

#### Returns

Type: `Microsoft.Extensions.DependencyInjection.IHttpClientBuilder`
The IHttpClientBuilder instance for method chaining.

#### Type Parameters

* `THandler` - The [DelegatingHandler](https://learn.microsoft.com/dotnet/api/system.net.http.delegatinghandler) type to pull from the scoped [ServiceProvider](https://learn.microsoft.com/dotnet/api/microsoft.extensions.dependencyinjection.serviceprovider).
