1 type derived from HttpRequestException
Microsoft.DotNet.VersionTools (1)
Automation\GitHubApi\HttpFailureResponseException.cs (1)
9public class HttpFailureResponseException : HttpRequestException
100 instantiations of HttpRequestException
http2cat (1)
src\Shared\runtime\Http2\Hpack\HPackEncoder.cs (1)
403throw new HttpRequestException(SR.net_http_request_invalid_char_encoding);
IIS.FunctionalTests (1)
src\Shared\runtime\Http2\Hpack\HPackEncoder.cs (1)
403throw new HttpRequestException(SR.net_http_request_invalid_char_encoding);
IIS.LongTests (1)
src\Shared\runtime\Http2\Hpack\HPackEncoder.cs (1)
403throw new HttpRequestException(SR.net_http_request_invalid_char_encoding);
IIS.NewHandler.FunctionalTests (1)
src\Shared\runtime\Http2\Hpack\HPackEncoder.cs (1)
403throw new HttpRequestException(SR.net_http_request_invalid_char_encoding);
IIS.NewShim.FunctionalTests (1)
src\Shared\runtime\Http2\Hpack\HPackEncoder.cs (1)
403throw new HttpRequestException(SR.net_http_request_invalid_char_encoding);
IISExpress.FunctionalTests (1)
src\Shared\runtime\Http2\Hpack\HPackEncoder.cs (1)
403throw new HttpRequestException(SR.net_http_request_invalid_char_encoding);
Microsoft.AspNetCore.Authentication.Facebook (1)
FacebookHandler.cs (1)
55throw new HttpRequestException($"An error occurred when retrieving Facebook user information ({response.StatusCode}). Please check if the authentication information is correct and the corresponding Facebook Graph API is enabled.");
Microsoft.AspNetCore.Authentication.Google (1)
GoogleHandler.cs (1)
53throw new HttpRequestException($"An error occurred when retrieving Google user information ({response.StatusCode}). Please check if the authentication information is correct.");
Microsoft.AspNetCore.Authentication.MicrosoftAccount (1)
MicrosoftAccountHandler.cs (1)
49throw new HttpRequestException($"An error occurred when retrieving Microsoft user information ({response.StatusCode}). Please check if the authentication information is correct and the corresponding Microsoft Account API is enabled.");
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (1)
src\Shared\runtime\Http2\Hpack\HPackEncoder.cs (1)
403throw new HttpRequestException(SR.net_http_request_invalid_char_encoding);
Microsoft.AspNetCore.Server.Kestrel.Core (1)
src\Shared\runtime\Http2\Hpack\HPackEncoder.cs (1)
403throw new HttpRequestException(SR.net_http_request_invalid_char_encoding);
Microsoft.AspNetCore.Shared.Tests (1)
src\Shared\runtime\Http2\Hpack\HPackEncoder.cs (1)
403throw new HttpRequestException(SR.net_http_request_invalid_char_encoding);
Microsoft.AspNetCore.SpaServices.Extensions (1)
Proxying\SpaProxy.cs (1)
120throw new HttpRequestException(
Microsoft.DotNet.Helix.Sdk (1)
AzureDevOpsTask.cs (1)
142throw new HttpRequestException(message);
Microsoft.Extensions.Http.Diagnostics.Tests (1)
Logging\HttpClientLoggerTest.cs (1)
82var exception = new HttpRequestException();
Microsoft.Extensions.Http.Polly.Tests (3)
DependencyInjection\PollyHttpClientBuilderExtensionsTest.cs (1)
292(req) => { throw new HttpRequestException("testing..."); },
PolicyHttpMessageHandlerTest.cs (2)
35throw new HttpRequestException(); 80throw new HttpRequestException();
Microsoft.Extensions.Http.Resilience.Tests (6)
Hedging\HedgingTests.cs (1)
355throw new HttpRequestException("Something went wrong!");
Hedging\HttpClientHedgingResiliencePredicatesTests.cs (2)
22Assert.True(HttpClientHedgingResiliencePredicates.IsTransientHttpException(new HttpRequestException())); 31Assert.True(HttpClientHedgingResiliencePredicates.IsTransient(Outcome.FromException<HttpResponseMessage>(new HttpRequestException())));
Polly\HttpCircuitBreakerStrategyOptionsTests.cs (1)
23new object[] { new HttpRequestException(), true },
Polly\HttpClientResiliencePredicatesTests.cs (1)
20new object[] { new HttpRequestException(), true },
Polly\HttpRetryStrategyOptionsTests.cs (1)
25[new HttpRequestException(), null!, true],
System.Net.Http (75)
src\libraries\Common\src\System\Net\Http\aspnetcore\Http2\Hpack\HPackEncoder.cs (1)
403throw new HttpRequestException(SR.net_http_request_invalid_char_encoding);
System\Net\Http\HttpContent.cs (3)
267throw new HttpRequestException(SR.net_http_content_read_as_stream_has_task); 747return new HttpRequestException(error, SR.net_http_content_stream_copy_error, e); 862return new HttpRequestException(HttpRequestError.ConfigurationLimitExceeded, SR.Format(CultureInfo.InvariantCulture, SR.net_http_content_buffersize_exceeded, maxBufferSize));
System\Net\Http\HttpResponseMessage.cs (1)
165throw new HttpRequestException(
System\Net\Http\SocketsHttpHandler\AuthenticationHelper.NtAuth.cs (1)
214throw new HttpRequestException(HttpRequestError.UserAuthenticationError, SR.Format(SR.net_http_authvalidationfailure, statusCode), statusCode: HttpStatusCode.Unauthorized);
System\Net\Http\SocketsHttpHandler\ConnectHelper.cs (2)
92HttpRequestException ex = new HttpRequestException(HttpRequestError.SecureConnectionError, SR.net_http_ssl_connection_failed, e); 143new HttpRequestException(DeduceError(exception), $"{exception.Message} ({host}:{port})", exception, RequestRetryType.RetryOnNextProxy);
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.cs (8)
470HttpRequestException exception = new(HttpRequestError.ExtendedConnectNotSupported, SR.net_unsupported_extended_connect); 537throw new HttpRequestException(HttpRequestError.VersionNegotiationError, SR.Format(SR.net_http_requested_version_server_refused, request.Version, request.VersionPolicy), e); 682stream = await streamTask.ConfigureAwait(false) ?? throw new HttpRequestException(SR.net_http_null_from_connect_callback); 769throw new HttpRequestException(SR.net_http_exception_during_plaintext_filter, e); 775throw new HttpRequestException(SR.net_http_null_from_plaintext_filter); 797throw new HttpRequestException(HttpRequestError.ProxyTunnelError, SR.Format(SR.net_http_proxy_tunnel_returned_failure_status_code, _proxyUri, (int)tunnelResponse.StatusCode), statusCode: tunnelResponse.StatusCode); 824throw new HttpRequestException(HttpRequestError.ProxyTunnelError, SR.net_http_proxy_tunnel_error, e); 847HttpRequestException ex = new(HttpRequestError.VersionNegotiationError, SR.Format(SR.net_http_requested_version_cannot_establish, request.Version, request.VersionPolicy, desiredVersion), inner);
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.Http2.cs (3)
201connectionException = new HttpRequestException(SR.Format(SR.net_ssl_http2_requires_tls12, sslStream.SslProtocol)); 265throw new HttpRequestException(SR.net_http_client_execution_error, e); 477HttpRequestException hre = new HttpRequestException(SR.net_http_http2_connection_not_established);
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.Http3.cs (1)
270throw new HttpRequestException(HttpRequestError.ConnectionError, "QUIC connected but no HTTP/3 indicated via ALPN.", null, RequestRetryType.RetryOnConnectionFailure);
System\Net\Http\SocketsHttpHandler\ContentLengthWriteStream.cs (3)
28throw new HttpRequestException(SR.net_http_content_write_larger_than_content_length); 42return ValueTask.FromException(new HttpRequestException(SR.net_http_content_write_larger_than_content_length)); 54return Task.FromException(new HttpRequestException(SR.Format(SR.net_http_request_content_length_mismatch, BytesWritten, _contentLength)));
System\Net\Http\SocketsHttpHandler\Http2Connection.cs (4)
1570throw new HttpRequestException(SR.Format(SR.net_http_request_headers_exceeded_length, maxHeaderListSize)); 2054throw new HttpRequestException(e.HttpRequestError, e.Message, e); 2058throw new HttpRequestException(HttpRequestError.Unknown, SR.net_http_client_execution_error, e); 2160throw new HttpRequestException((innerException as HttpIOException)?.HttpRequestError ?? HttpRequestError.Unknown, message, innerException, RequestRetryType.RetryOnConnectionFailure);
System\Net\Http\SocketsHttpHandler\Http2Stream.cs (10)
232throw new HttpRequestException(SR.Format(SR.net_http_request_content_length_mismatch, writeStream.BytesWritten, writeStream.ContentLength)); 560throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.net_http_invalid_response); 583throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.net_http_invalid_response); 609throw new HttpRequestException(HttpRequestError.ConfigurationLimitExceeded, SR.Format(SR.net_http_response_headers_exceeded_length, _connection._pool.Settings.MaxResponseHeadersByteLength)); 631throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.net_http_invalid_response_multiple_status_codes); 638throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.net_http_invalid_response_pseudo_header_in_trailer); 701throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.net_http_invalid_response); 745throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.net_http_invalid_response); 754throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.Format(SR.net_http_invalid_response_header_name, Encoding.ASCII.GetString(name))); 1537return ValueTask.FromException(new HttpRequestException(SR.net_http_content_write_larger_than_content_length));
System\Net\Http\SocketsHttpHandler\Http3Connection.cs (3)
298throw new HttpRequestException(HttpRequestError.Unknown, SR.net_http_request_aborted, null, RequestRetryType.RetryOnConnectionFailure); 311throw new HttpRequestException(HttpRequestError.Unknown, SR.net_http_request_aborted, null, RequestRetryType.RetryOnConnectionFailure); 329throw new HttpRequestException(HttpRequestError.Unknown, SR.net_http_client_execution_error, _abortException, RequestRetryType.RetryOnConnectionFailure);
System\Net\Http\SocketsHttpHandler\Http3RequestStream.cs (17)
280throw new HttpRequestException(HttpRequestError.Unknown, SR.net_http_retry_on_older_version, ex, RequestRetryType.RetryOnLowerHttpVersion); 285throw new HttpRequestException(HttpRequestError.HttpProtocolError, SR.net_http_request_aborted, rejectedException, RequestRetryType.RetryOnConnectionFailure); 291throw new HttpRequestException(httpRequestError, SR.net_http_client_execution_error, innerException); 301throw new HttpRequestException(HttpRequestError.HttpProtocolError, SR.net_http_client_execution_error, abortException); 316throw new HttpRequestException(httpRequestError, SR.net_http_client_execution_error, _connection.AbortException); 330throw new HttpRequestException(HttpRequestError.Unknown, SR.net_http_request_aborted, ex, RequestRetryType.RetryOnConnectionFailure); 336throw new HttpRequestException(ex.HttpRequestError, SR.net_http_client_execution_error, ex); 341throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.net_http_invalid_response, ex); 346throw new HttpRequestException(HttpRequestError.Unknown, SR.net_http_client_execution_error, ex); 358throw new HttpRequestException(HttpRequestError.Unknown, SR.net_http_client_execution_error, ex); 458throw new HttpRequestException(SR.Format(SR.net_http_request_content_length_mismatch, sent, contentLength)); 499throw new HttpRequestException(SR.net_http_content_write_larger_than_content_length); 706throw new HttpRequestException(SR.Format(SR.net_http_request_headers_exceeded_length, maxHeaderListSize)); 908throw new HttpRequestException(HttpRequestError.ConfigurationLimitExceeded, SR.Format(SR.net_http_response_headers_exceeded_length, _connection.Pool.Settings.MaxResponseHeadersByteLength)); 949throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.Format(SR.net_http_invalid_response_header_name, Encoding.ASCII.GetString(name))); 1308throw new HttpRequestException(httpRequestError, SR.net_http_client_execution_error, _connection.AbortException); 1327throw new HttpIOException(HttpRequestError.Unknown, SR.net_http_client_execution_error, new HttpRequestException(SR.net_http_client_execution_error, ex));
System\Net\Http\SocketsHttpHandler\HttpConnection.cs (16)
322throw new HttpRequestException(SR.net_http_request_no_host); 529throw new HttpRequestException(SR.net_http_request_invalid_char_encoding); 924mappedException = new HttpRequestException(SR.net_http_client_execution_error, exception); 933mappedException = new HttpRequestException(error, SR.net_http_client_execution_error, ioe, _canRetry ? RequestRetryType.RetryOnConnectionFailure : RequestRetryType.NoRetry); 1065throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.Format(SR.net_http_invalid_response_status_line, Encoding.ASCII.GetString(line))); 1086throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.Format(SR.net_http_invalid_response_status_line, Encoding.ASCII.GetString(line))); 1094throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.Format(SR.net_http_invalid_response_status_code, Encoding.ASCII.GetString(line.Slice(9, 3)))); 1119throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.Format(SR.net_http_invalid_response_status_reason, Encoding.ASCII.GetString(reasonBytes.ToArray())), formatEx); 1125throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.Format(SR.net_http_invalid_response_status_line, Encoding.ASCII.GetString(line))); 1224throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.Format(SR.net_http_invalid_response_header_line, Encoding.ASCII.GetString(buffer.Slice(0, newLineIndex)))); 1323throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.Format(SR.net_http_invalid_response_header_name, "")); 1326throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.Format(SR.net_http_invalid_response_header_name, Encoding.ASCII.GetString(name))); 1330throw new HttpRequestException(HttpRequestError.ConfigurationLimitExceeded, SR.Format(SR.net_http_response_headers_exceeded_length, _pool.Settings.MaxResponseHeadersByteLength)); 1618throw new HttpRequestException(SR.net_http_chunk_too_large); 2073throw new HttpRequestException(HttpRequestError.UserAuthenticationError, SR.net_http_authconnectionfailure); 2089throw new HttpRequestException(HttpRequestError.UserAuthenticationError, SR.net_http_authconnectionfailure);
System\Net\Http\SocketsHttpHandler\HttpConnectionBase.cs (1)
185throw new HttpRequestException(HttpRequestError.InvalidResponse, SR.Format(SR.net_http_invalid_response_status_code, Encoding.ASCII.GetString(value)));
System\Net\Http\SocketsHttpHandler\SocketsHttpHandler.cs (1)
643return new HttpRequestException(SR.net_http_client_execution_error,
System.Net.Http.Json (1)
System\Net\Http\Json\LengthLimitReadStream.cs (1)
33throw new HttpRequestException(SR.Format(SR.net_http_content_buffersize_exceeded, limit));
204 references to HttpRequestException
Aspire.Hosting (2)
Dcp\KubernetesService.cs (2)
378private static bool RetryOnConnectivityErrors(Exception ex) => ex is HttpRequestException || ex is KubeConfigException; 380ex is HttpRequestException ||
Aspire.Hosting.Azure.Tests (2)
AzureCosmosDBEmulatorFunctionalTests.cs (2)
74ShouldHandle = new PredicateBuilder().Handle<HttpRequestException>() 137ShouldHandle = new PredicateBuilder().Handle<HttpRequestException>()
dotnet-openapi (1)
Commands\BaseCommand.cs (1)
329if (exception is HttpRequestException || exception is WebException)
dotnet-svcutil-lib (3)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\HttpChannelFactory.cs (1)
945catch (HttpRequestException requestException)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\HttpChannelHelpers.cs (2)
112public static HttpResponseMessage ProcessGetResponseWebException(HttpRequestException requestException, HttpRequestMessage request, HttpAbortReason abortReason) 126public static Exception ConvertHttpRequestException(HttpRequestException exception, HttpRequestMessage request, HttpAbortReason abortReason)
GenerateRulesMissingDocumentation (1)
Program.cs (1)
133catch (HttpRequestException e)
HttpStress (2)
Program.cs (2)
130if (e is HttpRequestException hre && hre.InnerException is IOException) 597if (e is HttpRequestException hre && hre.InnerException is SocketException se && se.SocketErrorCode == SocketError.AddressAlreadyInUse)
IIS.FunctionalTests (8)
Http3Tests.cs (8)
123var ex = await Assert.ThrowsAsync<HttpRequestException>(() => client.GetAsync(address)); 139var ex = await Assert.ThrowsAsync<HttpRequestException>(() => response.Content.ReadAsStringAsync()); 156var ex = await Assert.ThrowsAsync<HttpRequestException>(() => response.Content.ReadAsStringAsync()); 170var ex = await Assert.ThrowsAsync<HttpRequestException>(() => client.GetAsync(address));
IIS.LongTests (5)
src\Servers\IIS\IIS\test\Common.LongTests\ShutdownTests.cs (5)
70catch (HttpRequestException ex) when (ex.InnerException is IOException) 438catch (HttpRequestException ex) when (ex.InnerException is IOException | ex.InnerException is SocketException) 594catch (HttpRequestException ex) when (ex.InnerException is IOException | ex.InnerException is SocketException) 627catch (HttpRequestException) 645catch (HttpRequestException)
IIS.NewHandler.FunctionalTests (5)
src\Servers\IIS\IIS\test\Common.LongTests\ShutdownTests.cs (5)
70catch (HttpRequestException ex) when (ex.InnerException is IOException) 438catch (HttpRequestException ex) when (ex.InnerException is IOException | ex.InnerException is SocketException) 594catch (HttpRequestException ex) when (ex.InnerException is IOException | ex.InnerException is SocketException) 627catch (HttpRequestException) 645catch (HttpRequestException)
IIS.NewShim.FunctionalTests (5)
src\Servers\IIS\IIS\test\Common.LongTests\ShutdownTests.cs (5)
70catch (HttpRequestException ex) when (ex.InnerException is IOException) 438catch (HttpRequestException ex) when (ex.InnerException is IOException | ex.InnerException is SocketException) 594catch (HttpRequestException ex) when (ex.InnerException is IOException | ex.InnerException is SocketException) 627catch (HttpRequestException) 645catch (HttpRequestException)
IISExpress.FunctionalTests (7)
InProcess\IISExpressShutdownTests.cs (2)
35catch (HttpRequestException ex) when (ex.InnerException is IOException) 65catch (HttpRequestException ex) when (ex.InnerException is IOException | ex.InnerException is SocketException)
src\Servers\IIS\IIS\test\Common.LongTests\ShutdownTests.cs (5)
70catch (HttpRequestException ex) when (ex.InnerException is IOException) 438catch (HttpRequestException ex) when (ex.InnerException is IOException | ex.InnerException is SocketException) 594catch (HttpRequestException ex) when (ex.InnerException is IOException | ex.InnerException is SocketException) 627catch (HttpRequestException) 645catch (HttpRequestException)
InMemory.FunctionalTests (1)
KestrelMetricsTests.cs (1)
902await Assert.ThrowsAsync<HttpRequestException>(() => httpClient.SendAsync(httpRequestMessage));
Interop.FunctionalTests (22)
Http3\Http3RequestTests.cs (8)
571var ex = await Assert.ThrowsAsync<HttpRequestException>(() => sendTask).DefaultTimeout(); 627var ex = await Assert.ThrowsAsync<HttpRequestException>(async () => 680var ex = await Assert.ThrowsAnyAsync<HttpRequestException>(() => client.SendAsync(request, CancellationToken.None)).DefaultTimeout(); 1552catch (HttpRequestException) 1901await Assert.ThrowsAsync<HttpRequestException>(() => responseTask).DefaultTimeout();
Http3\Http3TlsTests.cs (2)
202var ex = await Assert.ThrowsAnyAsync<HttpRequestException>(() => sendTask).DefaultTimeout();
HttpClientHttp2InteropTests.cs (12)
599var exception = await Assert.ThrowsAsync<HttpRequestException>(() => client.GetAsync(url)).DefaultTimeout(); 628var exception = await Assert.ThrowsAsync<HttpRequestException>(() => response.Content.ReadAsStringAsync()).DefaultTimeout(); 741var responseEx = await Assert.ThrowsAsync<HttpRequestException>(() => response.Content.ReadAsStringAsync().DefaultTimeout()); 800var responseEx = await Assert.ThrowsAsync<HttpRequestException>(() => response.Content.ReadAsStringAsync().DefaultTimeout()); 1370var ex = await Assert.ThrowsAsync<HttpRequestException>(() => client.SendAsync(request).DefaultTimeout()); 1401var ex = await Assert.ThrowsAsync<HttpRequestException>(() => client.GetAsync(url)).DefaultTimeout();
Microsoft.AspNetCore.Authentication.Test (1)
TwitterTests.cs (1)
325await Assert.ThrowsAsync<HttpRequestException>(async () =>
Microsoft.AspNetCore.Diagnostics.Middleware.Tests (4)
Logging\AcceptanceTests.cs (4)
607var ex = await Assert.ThrowsAsync<HttpRequestException>(() => client.PutAsync("/error?body=true", content)); 641var ex = await Assert.ThrowsAsync<HttpRequestException>(() => client.PutAsync("/error?body=true", content));
Microsoft.AspNetCore.Diagnostics.Tests (1)
ExceptionHandlerTest.cs (1)
1161await Assert.ThrowsAsync<HttpRequestException>(async () => await server.CreateClient().GetAsync("/path"));
Microsoft.AspNetCore.InternalTesting.Tests (2)
HttpClientSlimTest.cs (2)
31await Assert.ThrowsAnyAsync<HttpRequestException>(() => HttpClientSlim.GetStringAsync(address)); 49await Assert.ThrowsAnyAsync<HttpRequestException>(
Microsoft.AspNetCore.Mvc.FunctionalTests (2)
TagHelpersTest.cs (2)
78var exception = await Assert.ThrowsAsync<HttpRequestException>(async () => await Client.GetAsync("http://localhost/Home/MyHtml"));
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (29)
Http3Tests.cs (8)
176var ex = await Assert.ThrowsAsync<HttpRequestException>(() => client.GetAsync(address)); 209var ex = await Assert.ThrowsAsync<HttpRequestException>(() => response.Content.ReadAsStringAsync()); 235var ex = await Assert.ThrowsAsync<HttpRequestException>(() => response.Content.ReadAsStringAsync()); 256var ex = await Assert.ThrowsAsync<HttpRequestException>(() => client.GetAsync(address));
Listener\RequestBodyTests.cs (2)
139await Assert.ThrowsAsync<HttpRequestException>(async () => await responseTask); 164await Assert.ThrowsAsync<HttpRequestException>(async () => await responseTask);
Listener\ResponseBodyTests.cs (4)
161await Assert.ThrowsAsync<HttpRequestException>(() => responseTask); 181await Assert.ThrowsAsync<HttpRequestException>(() => responseTask); 204await Assert.ThrowsAsync<HttpRequestException>(() => response.Content.LoadIntoBufferAsync()); 226await Assert.ThrowsAsync<HttpRequestException>(() => response.Content.LoadIntoBufferAsync());
ResponseBodyTests.cs (3)
243await Assert.ThrowsAsync<HttpRequestException>(() => SendRequestAsync(address)); 257await Assert.ThrowsAsync<HttpRequestException>(async () => await SendRequestAsync(address)); 275await Assert.ThrowsAsync<HttpRequestException>(() => SendRequestAsync(address));
ResponseSendFileTests.cs (4)
391await Assert.ThrowsAsync<HttpRequestException>(() => SendRequestAsync(address)); 419await Assert.ThrowsAsync<HttpRequestException>(() => SendRequestAsync(address)); 446await Assert.ThrowsAsync<HttpRequestException>(() => SendRequestAsync(address)); 473await Assert.ThrowsAsync<HttpRequestException>(() => SendRequestAsync(address));
ServerTests.cs (8)
182await Assert.ThrowsAsync<HttpRequestException>(async () => await responseTask); 204await Assert.ThrowsAsync<HttpRequestException>(async () => await responseTask); 216var ex = await Assert.ThrowsAsync<HttpRequestException>(async () => await requestTask); 221ex = await Assert.ThrowsAsync<HttpRequestException>(async () => await requestTask); 235var ex = await Assert.ThrowsAsync<HttpRequestException>(async () => await requestTask); 240ex = await Assert.ThrowsAsync<HttpRequestException>(async () => await requestTask);
Microsoft.AspNetCore.Server.IntegrationTesting (1)
Common\RetryHelper.cs (1)
56if (exception is HttpRequestException || exception is WebException)
Microsoft.AspNetCore.SignalR.Client.FunctionalTests (3)
HubConnectionTests.cs (3)
1514return writeContext.Exception is HttpRequestException; 1525var ex = await Assert.ThrowsAnyAsync<HttpRequestException>(() => hubConnection.StartAsync().DefaultTimeout());
Microsoft.AspNetCore.SignalR.Client.Tests (8)
HttpConnectionTests.ConnectionLifecycle.cs (1)
317await Assert.ThrowsAsync<HttpRequestException>(async () => await connection.Transport.Input.ReadAsync());
HttpConnectionTests.Transport.cs (3)
338await Assert.ThrowsAsync<HttpRequestException>(async () => await connection.StartAsync().DefaultTimeout()); 447await Assert.ThrowsAsync<HttpRequestException>(async () => await connection.Transport.Input.ReadAllAsync()); 551await Assert.ThrowsAsync<HttpRequestException>(async () => await connection.Transport.Input.ReadAllAsync());
LongPollingTransportTests.cs (3)
171var exception = await Assert.ThrowsAsync<HttpRequestException>(() => longPollingTransport.StartAsync(TestUri, TransferFormat.Binary)); 207await Assert.ThrowsAsync<HttpRequestException>(async () => 309var exception = await Assert.ThrowsAsync<HttpRequestException>(async () => await longPollingTransport.Input.ReadAllAsync().DefaultTimeout());
ServerSentEventsTransportTests.cs (1)
214var exception = await Assert.ThrowsAsync<HttpRequestException>(() => sseTransport.Input.ReadAllAsync().DefaultTimeout());
Microsoft.AspNetCore.SignalR.Tests (2)
EndToEndTests.cs (2)
389var exception = await Assert.ThrowsAsync<HttpRequestException>(() => connection.StartAsync().DefaultTimeout());
Microsoft.AspNetCore.SpaProxy (2)
SpaProxyLaunchManager.cs (2)
85catch (Exception exception) when (exception is HttpRequestException || 116catch (Exception exception) when (exception is HttpRequestException ||
Microsoft.AspNetCore.SpaServices.Extensions (1)
Proxying\SpaProxy.cs (1)
118catch (HttpRequestException ex)
Microsoft.AspNetCore.TestHost.Tests (12)
ClientHandlerTests.cs (2)
536var ex = await Assert.ThrowsAsync<HttpRequestException>(() => response.Content.ReadAsStringAsync());
RequestLifetimeTests.cs (4)
66var ex = await Assert.ThrowsAsync<HttpRequestException>(() => response.Content.ReadAsByteArrayAsync()); 89var ex = await Assert.ThrowsAsync<HttpRequestException>(() => response.Content.ReadAsByteArrayAsync());
ResponseBodyTests.cs (2)
97var requestException = await Assert.ThrowsAsync<HttpRequestException>(() => client.GetAsync("/"));
ResponseResetTests.cs (4)
125var ex = await Assert.ThrowsAsync<HttpRequestException>(() => response.Content.ReadAsByteArrayAsync()); 151var ex = await Assert.ThrowsAsync<HttpRequestException>(() => response.Content.ReadAsByteArrayAsync());
Microsoft.Build.Tasks.Core (2)
DownloadFile.cs (2)
160catch (HttpRequestException) 250if (actualException is HttpRequestException httpRequestException)
Microsoft.DotNet.Arcade.Sdk (1)
src\DownloadFile.cs (1)
179catch (Exception e) when (e is HttpRequestException ||
Microsoft.DotNet.Build.Tasks.Feed (3)
src\common\AzureStorageUtils.cs (2)
125catch (System.Net.Http.HttpRequestException toStore) 293catch (Exception e) when (e is HttpRequestException || e is TaskCanceledException)
src\PublishArtifactsInManifestBase.cs (1)
925catch (Exception toStore) when (toStore is HttpRequestException || toStore is TaskCanceledException)
Microsoft.DotNet.Deployment.Tasks.Links (3)
Microsoft.DotNet.Helix.Client (1)
HelixApi.cs (1)
21exception is HttpRequestException ||
Microsoft.DotNet.Helix.Sdk (3)
AzureDevOpsTask.cs (3)
98catch (HttpRequestException ex) 114catch (HttpRequestException ex) 186ex is HttpRequestException ||
Microsoft.DotNet.Internal.SymbolHelper (7)
SymbolPromotionHelper.cs (3)
45if (args.Outcome.Exception is HttpRequestException httpException) 65if (args.Outcome.Exception is HttpRequestException httpException) 162if (ex is HttpRequestException httpEx && httpEx.StatusCode == HttpStatusCode.BadRequest)
SymbolUploadHelperFactory.cs (4)
38/// <exception cref="HttpRequestException">If the symbol client download fails after retries.</exception> 89/// <exception cref="HttpRequestException">If the symbol client download fails after retries.</exception> 106if (args.Outcome.Exception is HttpRequestException httpException) 124if (args.Outcome.Exception is HttpRequestException httpException)
Microsoft.DotNet.VersionTools (1)
Automation\GitHubVersionsRepoUpdater.cs (1)
150catch (Exception ex) when (ex is HttpRequestException || ex is NotFastForwardUpdateException)
Microsoft.Extensions.Http (4)
Logging\LoggingHttpMessageHandler.cs (1)
76catch (HttpRequestException ex)
Logging\LoggingScopeHttpMessageHandler.cs (1)
76catch (HttpRequestException ex)
Logging\LogHelper.cs (2)
129public static void LogRequestFailed(this ILogger logger, TimeSpan duration, HttpRequestException exception) => 168public static void LogRequestPipelineFailed(this ILogger logger, TimeSpan duration, HttpRequestException exception) =>
Microsoft.Extensions.Http.Diagnostics.Tests (3)
Logging\HttpClientLoggerTest.cs (3)
82var exception = new HttpRequestException(); 110var actualException = await Assert.ThrowsAsync<HttpRequestException>(act);
Microsoft.Extensions.Http.Polly (1)
DependencyInjection\PollyHttpClientBuilderExtensions.cs (1)
203/// <item><description>Network failures (as <see cref="HttpRequestException"/>)</description></item>
Microsoft.Extensions.Http.Polly.Tests (2)
PolicyHttpMessageHandlerTest.cs (2)
23.Handle<HttpRequestException>() 61.Handle<HttpRequestException>()
Microsoft.Extensions.Http.Resilience (4)
Hedging\HttpHedgingStrategyOptions.cs (1)
23/// as well as <see cref="HttpRequestException"/>, <see cref="BrokenCircuitException"/>, and <see cref="TimeoutRejectedException"/> exceptions.
Polly\HttpCircuitBreakerStrategyOptions.cs (1)
20/// that is, timeouts, 5xx responses, and <see cref="HttpRequestException"/> exceptions.
Polly\HttpClientResiliencePredicates.cs (1)
50return exception is HttpRequestException or TimeoutRejectedException;
Polly\HttpRetryStrategyOptions.cs (1)
27/// as well as <see cref="HttpRequestException"/> and <see cref="TimeoutRejectedException"/> exceptions.
Microsoft.Extensions.Http.Resilience.PerformanceTests (2)
RetryBenchmark.cs (1)
48var builder = Policy.Handle<HttpRequestException>().Or<TimeoutRejectedException>().OrResult<HttpResponseMessage>(r =>
StandardResilienceBenchmark.cs (1)
43var builder = Policy.Handle<HttpRequestException>().Or<TimeoutRejectedException>().OrResult<HttpResponseMessage>(r =>
Microsoft.Extensions.Http.Resilience.Tests (2)
Hedging\HedgingTests.cs (2)
173var exception = await Assert.ThrowsAsync<HttpRequestException>(
netstandard (1)
netstandard.cs (1)
1130[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Net.Http.HttpRequestException))]
System.Net.Http (21)
System\Net\Http\DiagnosticsHelper.cs (1)
85errorType = (exception as HttpRequestException)?.HttpRequestError switch
System\Net\Http\HttpClient.cs (1)
617else if (e is HttpRequestException && cts.IsCancellationRequested) // if cancellationToken is canceled, cts will also be canceled
System\Net\Http\HttpContent.cs (1)
860private static HttpRequestException CreateOverCapacityException(long maxBufferSize)
System\Net\Http\HttpProtocolException.cs (1)
14/// <see cref="HttpRequestException"/> if a protocol error occurs.
System\Net\Http\HttpRequestError.cs (1)
7/// Defines error categories representing the reason for <see cref="HttpRequestException"/> or <see cref="HttpIOException"/>.
System\Net\Http\HttpRequestException.cs (2)
27/// Initializes a new instance of the <see cref="HttpRequestException" /> class with a specific message that describes the current exception, an inner exception, and an HTTP status code. 39/// Initializes a new instance of the <see cref="HttpRequestException" /> class with a specific message an inner exception, and an HTTP status code and an <see cref="HttpRequestError"/>.
System\Net\Http\HttpVersionPolicy.cs (2)
24/// Throwing <see cref="HttpRequestException" /> if a connection with higher or equal version cannot be established. 36/// Throwing <see cref="HttpRequestException" /> if a connection with the exact version cannot be established.
System\Net\Http\RequestRetryType.cs (1)
7/// Used with <see cref="HttpRequestException"/> to indicate if a request is safe to retry.
System\Net\Http\SocketsHttpHandler\ConnectHelper.cs (1)
92HttpRequestException ex = new HttpRequestException(HttpRequestError.SecureConnectionError, SR.net_http_ssl_connection_failed, e);
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.cs (6)
470HttpRequestException exception = new(HttpRequestError.ExtendedConnectNotSupported, SR.net_unsupported_extended_connect); 509catch (HttpRequestException e) when (e.AllowRetry == RequestRetryType.RetryOnConnectionFailure) 532catch (HttpRequestException e) when (e.AllowRetry == RequestRetryType.RetryOnLowerHttpVersion) 548catch (HttpRequestException e) when (e.AllowRetry == RequestRetryType.RetryOnStreamLimitReached) 823Debug.Assert(e is not HttpRequestException); 847HttpRequestException ex = new(HttpRequestError.VersionNegotiationError, SR.Format(SR.net_http_requested_version_cannot_establish, request.Version, request.VersionPolicy, desiredVersion), inner);
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.Http2.cs (1)
477HttpRequestException hre = new HttpRequestException(SR.net_http_http2_connection_not_established);
System\Net\Http\SocketsHttpHandler\Http3RequestStream.cs (1)
351if (ex is HttpRequestException)
System\Net\Http\SocketsHttpHandler\HttpConnectionPoolManager.cs (2)
429HttpRequestException rethrowException; 437catch (HttpRequestException ex) when (ex.AllowRetry != RequestRetryType.NoRetry)
System.Net.Requests (3)
System\Net\WebException.cs (2)
83if (exception is HttpRequestException hre) 103private static WebExceptionStatus GetStatusFromExceptionHelper(HttpRequestException ex)
System\Net\WebExceptionPal.Unix.cs (1)
10internal static WebExceptionStatus GetStatusFromException(HttpRequestException ex)
System.Net.WebSockets.Client (1)
System\Net\WebSockets\WebSocketHandle.Managed.cs (1)
137catch (HttpRequestException ex) when
System.ServiceModel.Http (3)
System\ServiceModel\Channels\HttpChannelFactory.cs (1)
1065catch (HttpRequestException requestException)
System\ServiceModel\Channels\HttpChannelHelpers.cs (2)
103public static HttpResponseMessage ProcessGetResponseWebException(HttpRequestException requestException, HttpRequestMessage request, HttpAbortReason abortReason) 117public static Exception ConvertHttpRequestException(HttpRequestException exception, HttpRequestMessage request, HttpAbortReason abortReason)
Templates.Blazor.WebAssembly.Auth.Tests (1)
src\Shared\E2ETesting\SauceConnectServer.cs (1)
170catch (HttpRequestException)
Templates.Blazor.WebAssembly.Tests (1)
src\Shared\E2ETesting\SauceConnectServer.cs (1)
170catch (HttpRequestException)
Templates.Mvc.Tests (1)
src\Shared\E2ETesting\SauceConnectServer.cs (1)
170catch (HttpRequestException)
Templates.Tests (1)
src\Shared\E2ETesting\SauceConnectServer.cs (1)
170catch (HttpRequestException)