protected internal override async Task <HttpResponseMessage> SendAsync(HttpRequestMessage request,
CancellationToken cancellationToken)
{
CheckDisposed();
SetOperationStarted();
HttpResponseMessage response;
try
{
await ConfigureRequest(request).ConfigureAwait(false);
Task <HttpResponseMessage> responseTask = DiagnosticsHandler.IsEnabled() ?
_diagnosticsPipeline.SendAsync(request, cancellationToken) :
_handlerToFilter.SendAsync(request, cancellationToken);
response = await responseTask.ConfigureAwait(false);
}
catch (OperationCanceledException)
{
throw;
}
catch (Exception ex)
{
// Convert back to the expected exception type
throw new HttpRequestException(SR.net_http_client_execution_error, ex);
}
ProcessResponse(response);
return(response);
}