Class StaticStringResponseBuilder
IResponseBuilder implementation that returns a static response.
Implements
Namespace: Tableau.Migration.Net.Simulation.Responses
Assembly: Tableau.Migration.dll
Syntax
public class StaticStringResponseBuilder : IResponseBuilder
Constructors
StaticStringResponseBuilder(string?, HttpStatusCode, string, bool)
Creates a new StaticStringResponseBuilder object.
Declaration
public StaticStringResponseBuilder(string? response, HttpStatusCode statusCode = HttpStatusCode.OK, string contentType = "application/xml", bool requiresAuthentication = true)
Parameters
| Type | Name | Description |
|---|---|---|
| string | response | The response content. |
| HttpStatusCode | statusCode | The response status code. |
| string | contentType | The response content type. |
| bool | requiresAuthentication | Whether the response requires an authenticated request. |
Properties
RequiresAuthentication
Gets whether or not an unauthenticated response should be returned if the request is unauthenticated.
Declaration
public bool RequiresAuthentication { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
RespondAsync(HttpRequestMessage, CancellationToken)
Builds a HTTP response for the given request.
Declaration
public virtual Task<HttpResponseMessage> RespondAsync(HttpRequestMessage request, CancellationToken cancel)
Parameters
| Type | Name | Description |
|---|---|---|
| HttpRequestMessage | request | The HTTP request to respond to. |
| CancellationToken | cancel | The cancellation token to obey. |
Returns
| Type | Description |
|---|---|
| Task<HttpResponseMessage> | The HTTP response. |