Table of Contents

Class ProblemDetailsHttpClient

Namespace
MRX.UI.ErrorsAutoWiring.Http
Assembly
MRX.UI.ErrorsAutoWiring.dll

An HTTP client that sends requests and maps any RFC 7807 problem details error response onto the validation messages of an EditContext.

public class ProblemDetailsHttpClient
Inheritance
ProblemDetailsHttpClient
Inherited Members

Constructors

ProblemDetailsHttpClient(HttpClient, IOptions<ProblemDetailsHttpClientOptions>)

An HTTP client that sends requests and maps any RFC 7807 problem details error response onto the validation messages of an EditContext.

public ProblemDetailsHttpClient(HttpClient httpClient, IOptions<ProblemDetailsHttpClientOptions> options)

Parameters

httpClient HttpClient

The underlying HTTP client used to send requests.

options IOptions<ProblemDetailsHttpClientOptions>

The options controlling how errors are mapped to fields.

Methods

SendContextAwareAsync(EditContext, HttpRequestMessage, CancellationToken)

Sends an HTTP request and, if the response is a problem details error, maps its errors onto editContext's validation message store.

public Task<HttpResponseMessage> SendContextAwareAsync(EditContext editContext, HttpRequestMessage request, CancellationToken cancellationToken)

Parameters

editContext EditContext

The edit context whose model must be a DataBindingSources instance.

request HttpRequestMessage

The HTTP request to send.

cancellationToken CancellationToken

A token used to cancel the operation.

Returns

Task<HttpResponseMessage>

The HTTP response returned by the underlying client.

Exceptions

InvalidOperationException

Thrown when editContext's model is not a DataBindingSources.