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

# HttpClientHelpers

> Helper methods for dealing with [HttpRequestMessage](https://learn.microsoft.com/dotnet/api/system.net.http.httprequestmessage).

## Definition

**Assembly:** CloudNimble.Breakdance.AspNetCore.dll

**Namespace:** CloudNimble.Breakdance.AspNetCore

**Inheritance:** System.Object

## Syntax

```csharp theme={"dark"}
CloudNimble.Breakdance.AspNetCore.HttpClientHelpers
```

## Summary

Helper methods for dealing with [HttpRequestMessage](https://learn.microsoft.com/dotnet/api/system.net.http.httprequestmessage).

## Methods

### <Icon icon="thumbtack" iconType="duotone" color="#419AC5" size={24} className="mr-2" /> GetTestableHttpRequestMessage

Gets an [HttpRequestMessage](https://learn.microsoft.com/dotnet/api/system.net.http.httprequestmessage) instance properly configured to be used to make test requests.

#### Syntax

```csharp theme={"dark"}
public static System.Net.Http.HttpRequestMessage GetTestableHttpRequestMessage(System.Net.Http.HttpMethod httpMethod, string host = "http://localhost/", string routePrefix = "api/tests/", string resource = "", string acceptHeader = "application/json", object payload = null, System.Text.Json.JsonSerializerOptions jsonSerializerSettings = null)
```

#### Parameters

| Name                     | Type                                     | Description                                                                                                                                                                 |
| ------------------------ | ---------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `httpMethod`             | `System.Net.Http.HttpMethod`             | The [HttpMethod](https://learn.microsoft.com/dotnet/api/system.net.http.httpmethod) to use for the request.                                                                 |
| `host`                   | `string`                                 | The hostname to use for this request. Defaults to "[http://localhost](http://localhost)", only change it if that collides with other services running on the local machine. |
| `routePrefix`            | `string`                                 | The routePrefix corresponding to the route already mapped in MapRestierRoute or GetTestableConfiguration. Defaults to "api/test", only change it if absolutely necessary.   |
| `resource`               | `string`                                 | The resource on the API to be requested.                                                                                                                                    |
| `acceptHeader`           | `string`                                 | The inbound MIME types to accept. Defaults to "application/json".                                                                                                           |
| `payload`                | `object`                                 | -                                                                                                                                                                           |
| `jsonSerializerSettings` | `System.Text.Json.JsonSerializerOptions` | -                                                                                                                                                                           |

#### Returns

Type: `System.Net.Http.HttpRequestMessage`
An [HttpRequestMessage](https://learn.microsoft.com/dotnet/api/system.net.http.httprequestmessage) that is ready to be sent through an HttpClient instance configured for the test.
