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
httpClientHttpClientThe underlying HTTP client used to send requests.
optionsIOptions<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
editContextEditContextThe edit context whose model must be a DataBindingSources instance.
requestHttpRequestMessageThe HTTP request to send.
cancellationTokenCancellationTokenA 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.