I don't why, but I needed to change @Craig SendAsync
method from InterceptingHttpMessageHandler
to:
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
var _request = new HttpRequestMessage(HttpMethod.Post, request.RequestUri)
{
Content = request.Content!
};
foreach (var header in request.Headers)
{
_request.Headers.TryAddWithoutValidation(header.Key, header.Value);
}
return await _client.SendAsync(_request, cancellationToken);
}
I was getting the following error:
The message with Action '' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher...