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

# HttpResponseMessage

> Extension methods for HttpResponseMessage from System.Net.Http

## Definition

**Assembly:** System.Net.Http.dll

**Namespace:** System.Net.Http

## Syntax

```csharp theme={"dark"}
System.Net.Http.HttpResponseMessage
```

## Summary

This type is defined in System.Net.Http.

## Remarks

See [Microsoft documentation](https://learn.microsoft.com/dotnet/api/system.net.http.httpresponsemessage) for more information about the rest of the API.

## Methods

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

<Note>Extension method from `System.Net.Http.EasyAF_Http_NewtonsoftJson_HttpResponseMessageExtensions`</Note>

Deserializes the HTTP response message content to the specified type using Newtonsoft.Json with default settings.
Returns either the deserialized response or error content as a string.

#### Syntax

```csharp theme={"dark"}
public static System.Threading.Tasks.Task<(T, string)> DeserializeResponseAsync<T>(System.Net.Http.HttpResponseMessage message)
```

#### Parameters

| Name      | Type                                  | Description                               |
| --------- | ------------------------------------- | ----------------------------------------- |
| `message` | `System.Net.Http.HttpResponseMessage` | The HTTP response message to deserialize. |

#### Returns

Type: `System.Threading.Tasks.Task<(T, string)>`
A tuple containing either the deserialized response object or error content string.

#### Type Parameters

* `T` - The type to deserialize the response content to.

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

<Note>Extension method from `System.Net.Http.EasyAF_Http_NewtonsoftJson_HttpResponseMessageExtensions`</Note>

Deserializes the HTTP response message content to the specified type using Newtonsoft.Json with custom settings.
Automatically configures SystemTextJsonContractResolver if not already set. Returns either the deserialized response or error content as a string.

#### Syntax

```csharp theme={"dark"}
public static System.Threading.Tasks.Task<(T, string)> DeserializeResponseAsync<T>(System.Net.Http.HttpResponseMessage message, Newtonsoft.Json.JsonSerializerSettings settings)
```

#### Parameters

| Name       | Type                                     | Description                                              |
| ---------- | ---------------------------------------- | -------------------------------------------------------- |
| `message`  | `System.Net.Http.HttpResponseMessage`    | The HTTP response message to deserialize.                |
| `settings` | `Newtonsoft.Json.JsonSerializerSettings` | The JSON serializer settings to use for deserialization. |

#### Returns

Type: `System.Threading.Tasks.Task<(T, string)>`
A tuple containing either the deserialized response object or error content string.

#### Type Parameters

* `T` - The type to deserialize the response content to.

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

<Note>Extension method from `System.Net.Http.EasyAF_Http_NewtonsoftJson_HttpResponseMessageExtensions`</Note>

Deserializes the HTTP response message content to strongly-typed response and error objects using Newtonsoft.Json with default settings.
Provides type-safe error handling by deserializing error responses to a specific error type.

#### Syntax

```csharp theme={"dark"}
public static System.Threading.Tasks.Task<(TResponse, TError)> DeserializeResponseAsync<TResponse, TError>(System.Net.Http.HttpResponseMessage message)
```

#### Parameters

| Name      | Type                                  | Description                               |
| --------- | ------------------------------------- | ----------------------------------------- |
| `message` | `System.Net.Http.HttpResponseMessage` | The HTTP response message to deserialize. |

#### Returns

Type: `System.Threading.Tasks.Task<(TResponse, TError)>`
A tuple containing either the deserialized response object or deserialized error object.

#### Type Parameters

* `TResponse` - The type to deserialize successful response content to.
* `TError` - The type to deserialize error response content to.

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

<Note>Extension method from `System.Net.Http.EasyAF_Http_NewtonsoftJson_HttpResponseMessageExtensions`</Note>

Deserializes the HTTP response message content to strongly-typed response and error objects using Newtonsoft.Json with custom settings.
Automatically configures SystemTextJsonContractResolver if not already set. Provides type-safe error handling by deserializing error responses to a specific error type.

#### Syntax

```csharp theme={"dark"}
public static System.Threading.Tasks.Task<(TResponse, TError)> DeserializeResponseAsync<TResponse, TError>(System.Net.Http.HttpResponseMessage message, Newtonsoft.Json.JsonSerializerSettings settings)
```

#### Parameters

| Name       | Type                                     | Description                                              |
| ---------- | ---------------------------------------- | -------------------------------------------------------- |
| `message`  | `System.Net.Http.HttpResponseMessage`    | The HTTP response message to deserialize.                |
| `settings` | `Newtonsoft.Json.JsonSerializerSettings` | The JSON serializer settings to use for deserialization. |

#### Returns

Type: `System.Threading.Tasks.Task<(TResponse, TError)>`
A tuple containing either the deserialized response object or deserialized error object.

#### Type Parameters

* `TResponse` - The type to deserialize successful response content to.
* `TError` - The type to deserialize error response content to.

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

<Note>Extension method from `System.Net.Http.EasyAF_Http_SystemTextJson_HttpResponseMessageExtensions`</Note>

Deserializes the HTTP response message content to the specified type using System.Text.Json with default options.
Returns either the deserialized response or error content as a string.

#### Syntax

```csharp theme={"dark"}
public static System.Threading.Tasks.Task<(T, string)> DeserializeResponseAsync<T>(System.Net.Http.HttpResponseMessage message)
```

#### Parameters

| Name      | Type                                  | Description                               |
| --------- | ------------------------------------- | ----------------------------------------- |
| `message` | `System.Net.Http.HttpResponseMessage` | The HTTP response message to deserialize. |

#### Returns

Type: `System.Threading.Tasks.Task<(T, string)>`
A tuple containing either the deserialized response object or error content string.

#### Type Parameters

* `T` - The type to deserialize the response content to.

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

<Note>Extension method from `System.Net.Http.EasyAF_Http_SystemTextJson_HttpResponseMessageExtensions`</Note>

Deserializes the HTTP response message content to the specified type using System.Text.Json with custom options.
Returns either the deserialized response or error content as a string.

#### Syntax

```csharp theme={"dark"}
public static System.Threading.Tasks.Task<(T, string)> DeserializeResponseAsync<T>(System.Net.Http.HttpResponseMessage message, System.Text.Json.JsonSerializerOptions settings)
```

#### Parameters

| Name       | Type                                     | Description                                             |
| ---------- | ---------------------------------------- | ------------------------------------------------------- |
| `message`  | `System.Net.Http.HttpResponseMessage`    | The HTTP response message to deserialize.               |
| `settings` | `System.Text.Json.JsonSerializerOptions` | The JSON serializer options to use for deserialization. |

#### Returns

Type: `System.Threading.Tasks.Task<(T, string)>`
A tuple containing either the deserialized response object or error content string.

#### Type Parameters

* `T` - The type to deserialize the response content to.

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

<Note>Extension method from `System.Net.Http.EasyAF_Http_SystemTextJson_HttpResponseMessageExtensions`</Note>

Deserializes the HTTP response message content to strongly-typed response and error objects using System.Text.Json with default options.
Provides type-safe error handling by deserializing error responses to a specific error type.

#### Syntax

```csharp theme={"dark"}
public static System.Threading.Tasks.Task<(TResponse, TError)> DeserializeResponseAsync<TResponse, TError>(System.Net.Http.HttpResponseMessage message)
```

#### Parameters

| Name      | Type                                  | Description                               |
| --------- | ------------------------------------- | ----------------------------------------- |
| `message` | `System.Net.Http.HttpResponseMessage` | The HTTP response message to deserialize. |

#### Returns

Type: `System.Threading.Tasks.Task<(TResponse, TError)>`
A tuple containing either the deserialized response object or deserialized error object.

#### Type Parameters

* `TResponse` - The type to deserialize successful response content to.
* `TError` - The type to deserialize error response content to.

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

<Note>Extension method from `System.Net.Http.EasyAF_Http_SystemTextJson_HttpResponseMessageExtensions`</Note>

Deserializes the HTTP response message content to strongly-typed response and error objects using System.Text.Json with custom options.
Provides type-safe error handling by deserializing error responses to a specific error type.

#### Syntax

```csharp theme={"dark"}
public static System.Threading.Tasks.Task<(TResponse, TError)> DeserializeResponseAsync<TResponse, TError>(System.Net.Http.HttpResponseMessage message, System.Text.Json.JsonSerializerOptions settings)
```

#### Parameters

| Name       | Type                                     | Description                                             |
| ---------- | ---------------------------------------- | ------------------------------------------------------- |
| `message`  | `System.Net.Http.HttpResponseMessage`    | The HTTP response message to deserialize.               |
| `settings` | `System.Text.Json.JsonSerializerOptions` | The JSON serializer options to use for deserialization. |

#### Returns

Type: `System.Threading.Tasks.Task<(TResponse, TError)>`
A tuple containing either the deserialized response object or deserialized error object.

#### Type Parameters

* `TResponse` - The type to deserialize successful response content to.
* `TError` - The type to deserialize error response content to.
