Breakdance_WebApi_HttpClientExtensions

Extension methods for making a little more test-friendly.

Syntax

public static class Breakdance_WebApi_HttpClientExtensions

Inheritance

Methods

ExecuteTestRequest

public static Task<HttpResponseMessage> ExecuteTestRequest(this HttpClient httpClient, HttpMethod httpMethod, string host = null, string routePrefix = null, string resource = null, string acceptHeader = null, object payload = null, JsonSerializerSettings jsonSerializerSettings = null)
Creates an for the given configuration and executes it asynchronously through the HttpClient.

Parameters

  • httpClient HttpClient: The instance to use.
  • httpMethod HttpMethod: The to use for the request.
  • host string: The hostname to use for this request. Defaults to “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 JsonSerializerSettings:

Returns

Task<HttpResponseMessage> An containing the results of the attempted request.