Skip to main content

Definition

Assembly: CloudNimble.Breakdance.AspNetCore.dll Namespace: CloudNimble.Breakdance.AspNetCore Inheritance: System.Object

Syntax

CloudNimble.Breakdance.AspNetCore.HttpClientHelpers

Summary

Helper methods for dealing with HttpRequestMessage.

Methods

GetTestableHttpRequestMessage

Gets an HttpRequestMessage instance properly configured to be used to make test requests.

Syntax

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

NameTypeDescription
httpMethodSystem.Net.Http.HttpMethodThe HttpMethod to use for the request.
hoststringThe hostname to use for this request. Defaults to “http://localhost”, only change it if that collides with other services running on the local machine.
routePrefixstringThe routePrefix corresponding to the route already mapped in MapRestierRoute or GetTestableConfiguration. Defaults to “api/test”, only change it if absolutely necessary.
resourcestringThe resource on the API to be requested.
acceptHeaderstringThe inbound MIME types to accept. Defaults to “application/json”.
payloadobject-
jsonSerializerSettingsSystem.Text.Json.JsonSerializerOptions-

Returns

Type: System.Net.Http.HttpRequestMessage An HttpRequestMessage that is ready to be sent through an HttpClient instance configured for the test.