415 instantiations of HttpClient
aspire (4)
Telemetry\InternalMicrosoftDetector.cs (2)
1100? new HttpClient() 1101: new HttpClient(_gitHubHttpMessageHandler, disposeHandler: false);
Utils\CliDownloader.cs (1)
30private static readonly HttpClient s_httpClient = new();
Utils\EnvironmentChecker\DcpConnectionChecker.cs (1)
52using var client = new HttpClient(handler)
Aspire.Acquisition.Tests (1)
Scripts\Common\ScriptHostFixture.cs (1)
78using var client = new HttpClient();
Aspire.Cli.EndToEnd.Tests (2)
Helpers\CliE2ETestHelpers.cs (1)
621private static readonly HttpClient s_nuGetHttpClient = new() { Timeout = TimeSpan.FromSeconds(30) };
RepositoryToolUpdateTests.cs (1)
230using var httpClient = new HttpClient { Timeout = TimeSpan.FromSeconds(30) };
Aspire.Cli.Tests (29)
Agents\SigstoreNpmProvenanceCheckerTests.cs (1)
1195using var httpClient = new HttpClient(handler);
Mcp\ApiDocs\ApiDocsCacheTests.cs (2)
34using var httpClient = new HttpClient(handler); 60using var httpClient = new HttpClient(handler);
Mcp\ApiDocs\ApiDocsFetcherTests.cs (3)
38using var httpClient = new HttpClient(handler); 64using var httpClient = new HttpClient(handler); 91using var httpClient = new HttpClient(handler);
Mcp\Docs\DocsCacheTests.cs (1)
32using var httpClient = new HttpClient(handler);
Mcp\Docs\DocsFetcherTests.cs (17)
40using var httpClient = new HttpClient(handler); 60using var httpClient = new HttpClient(handler); 81using var httpClient = new HttpClient(handler); 108using var httpClient = new HttpClient(handler); 130using var httpClient = new HttpClient(handler); 165using var httpClient = new HttpClient(handler); 183using var httpClient = new HttpClient(handler); 196using var httpClient = new HttpClient(handler); 209using var httpClient = new HttpClient(handler); 230using var httpClient = new HttpClient(handler); 250using var httpClient = new HttpClient(handler); 269using var httpClient = new HttpClient(handler); 292using var httpClient = new HttpClient(handler); 313using var httpClient = new HttpClient(handler); 333using var httpClient = new HttpClient(handler); 366using var httpClient = new HttpClient(handler); 384using var httpClient = new HttpClient(handler);
Telemetry\AgentTelemetryPersistenceTests.cs (3)
125using var client = new HttpClient(handler); 164using var client = new HttpClient(handler); 232using var httpClient = new HttpClient(handler);
TestServices\TestHttpClientFactory.cs (1)
13return new HttpClient();
Utils\MockHttpClientFactory.cs (1)
19return new HttpClient(handler, disposeHandler: false);
Aspire.Dashboard (1)
Model\DebugSessionHelpers.cs (1)
38var client = new HttpClient(resolvedHandler)
Aspire.Dashboard.Tests (33)
Integration\BlazorWebSocketOriginTests.cs (1)
23using var client = new HttpClient { BaseAddress = frontendUri };
Integration\FrontendBrowserTokenAuthTests.cs (10)
40using var client = new HttpClient { BaseAddress = new Uri($"http://{app.FrontendSingleEndPointAccessor().EndPoint}") }; 62using var client = new HttpClient { BaseAddress = new Uri($"http://{app.FrontendSingleEndPointAccessor().EndPoint}") }; 105using var client = new HttpClient(handler); 152using var client = new HttpClient(handler); 192using var client = new HttpClient(handler); 235using var client = new HttpClient(new HttpClientHandler { AllowAutoRedirect = true, UseCookies = true }) 269using var client = new HttpClient(handler) 298using var client = new HttpClient { BaseAddress = new Uri($"http://{app.OtlpServiceHttpEndPointAccessor().EndPoint}") }; 322using var client = new HttpClient { BaseAddress = new Uri($"http://{app.FrontendSingleEndPointAccessor().EndPoint}") }; 347using var client = new HttpClient { BaseAddress = new Uri($"http://{app.FrontendSingleEndPointAccessor().EndPoint}") };
Integration\FrontendOpenIdConnectAuthTests.cs (2)
36using var client = new HttpClient(handler) { BaseAddress = new Uri($"http://{app.FrontendSingleEndPointAccessor().EndPoint}") }; 81using var client = new HttpClient(handler) { BaseAddress = new Uri($"http://{app.OtlpServiceHttpEndPointAccessor().EndPoint}") };
Integration\HealthTests.cs (2)
30using var client = new HttpClient(httpClientHandler) { BaseAddress = new Uri(basePath) }; 52using var client = new HttpClient { BaseAddress = new Uri($"http://{fixture.App.FrontendSingleEndPointAccessor().EndPoint}") };
Integration\IntegrationTestHelpers.cs (1)
135return new HttpClient(handler) { BaseAddress = new Uri(address) };
Integration\OtlpHttpServiceTests.cs (6)
315using var client = new HttpClient { BaseAddress = new Uri($"http://{endpoint.EndPoint}") }; 346using var client = new HttpClient { BaseAddress = new Uri($"http://{endpoint.EndPoint}") }; 393using var client = new HttpClient { BaseAddress = new Uri($"http://{endpoint.EndPoint}") }; 418using var client = new HttpClient { BaseAddress = new Uri($"http://{endpoint.EndPoint}") }; 447using var client = new HttpClient { BaseAddress = new Uri($"http://{endpoint.EndPoint}") }; 476using var client = new HttpClient { BaseAddress = new Uri($"http://{endpoint.EndPoint}") };
Integration\Playwright\NativeAotDashboardTests.cs (2)
153using var client = new HttpClient { BaseAddress = new Uri(otlpUrl) }; 171using var client = new HttpClient();
Integration\ResponseCompressionTests.cs (2)
22using var client = new HttpClient(httpClientHandler) { BaseAddress = new Uri($"http://{app.FrontendSingleEndPointAccessor().EndPoint}") }; 45using var client = new HttpClient(httpClientHandler) { BaseAddress = new Uri($"http://{app.FrontendSingleEndPointAccessor().EndPoint}") };
Integration\StartupTests.cs (4)
425using var httpClient = new HttpClient(new HttpClientHandler 532using var httpClient = new HttpClient() 961using var client = new HttpClient { BaseAddress = new Uri($"http://{app.FrontendSingleEndPointAccessor().EndPoint}") }; 1038using var client = new HttpClient { BaseAddress = new Uri($"http://{endpointString}") };
Integration\TelemetryApiTests.cs (3)
64using var httpClient = new HttpClient(handler) { BaseAddress = new Uri($"http://{app.FrontendSingleEndPointAccessor().EndPoint}") }; 136using var httpClient = new HttpClient(handler) { BaseAddress = new Uri($"http://{app.FrontendSingleEndPointAccessor().EndPoint}") }; 307using var httpClient = new HttpClient(handler) { BaseAddress = new Uri($"http://{app.FrontendSingleEndPointAccessor().EndPoint}") };
Aspire.Deployment.EndToEnd.Tests (7)
AcaExpressDeploymentTests.cs (2)
55using var managementClient = new HttpClient(); 347using var client = new HttpClient(handler) { Timeout = TimeSpan.FromSeconds(75) };
FoundryDotnetProjectDeploymentTests.cs (1)
164using var http = new HttpClient();
FoundryHostedAgentDeploymentTests.cs (3)
234using var client = new HttpClient(); 292using var client = new HttpClient(); 462using var client = new HttpClient();
Helpers\DotnetProjectDeploymentHelpers.cs (1)
72using var client = new HttpClient(handler) { Timeout = TimeSpan.FromSeconds(15) };
Aspire.Hosting (1)
Backchannel\AuxiliaryBackchannelRpcTarget.cs (1)
1944var httpClient = httpClientFactory?.CreateClient() ?? new HttpClient();
Aspire.Hosting.Azure.Tests (32)
AcrLoginServiceTests.cs (1)
130public HttpClient CreateClient(string name) => new(handler, disposeHandler: false);
AzureSandboxesTests.cs (26)
525var client = new AzureDevComputeClient(new HttpClient(handler), credential, NullLogger.Instance); 570new HttpClient(handler), 649var client = new AzureDevComputeClient(new HttpClient(handler), new RecordingTokenCredential(), NullLogger.Instance); 679var client = new AzureDevComputeClient(new HttpClient(handler), new RecordingTokenCredential(), NullLogger.Instance); 1312var client = new AzureDevComputeClient(new HttpClient(handler), credential, NullLogger.Instance, TimeSpan.Zero); 1334new HttpClient(handler), 1386var client = new AzureDevComputeClient(new HttpClient(handler), new RecordingTokenCredential(), NullLogger.Instance, TimeSpan.Zero); 1408var client = new AzureDevComputeClient(new HttpClient(handler), new RecordingTokenCredential(), NullLogger.Instance, TimeSpan.Zero); 1428var client = new AzureDevComputeClient(new HttpClient(handler), new RecordingTokenCredential(), NullLogger.Instance, TimeSpan.Zero); 1453var client = new AzureDevComputeClient(new HttpClient(handler), new RecordingTokenCredential(), NullLogger.Instance, TimeSpan.Zero); 1474new HttpClient(handler), 1497new HttpClient(handler), 1523new HttpClient(handler), 1549new HttpClient(handler), 1572new HttpClient(handler), 1594new HttpClient(handler), 1618new HttpClient(handler), 1640var client = new AzureDevComputeClient(new HttpClient(handler), new RecordingTokenCredential(), NullLogger.Instance); 1662var client = new AzureDevComputeClient(new HttpClient(handler), new RecordingTokenCredential(), NullLogger.Instance); 1685var client = new AzureDevComputeClient(new HttpClient(handler), new RecordingTokenCredential(), NullLogger.Instance); 1753var client = new AzureDevComputeClient(new HttpClient(handler), new RecordingTokenCredential(), NullLogger.Instance); 1816var client = new AzureDevComputeClient(new HttpClient(handler), new RecordingTokenCredential(), NullLogger.Instance); 1867var client = new AzureDevComputeClient(new HttpClient(handler), new RecordingTokenCredential(), NullLogger.Instance); 1920var client = new AzureDevComputeClient(new HttpClient(handler), new RecordingTokenCredential(), NullLogger.Instance); 1972var client = new AzureDevComputeClient(new HttpClient(handler), new RecordingTokenCredential(), NullLogger.Instance); 3649return new HttpClient(handler, disposeHandler: false);
FoundryExtensionsTests.cs (5)
415using var httpClient = new HttpClient(handler); 448using var httpClient = new HttpClient(handler); 470using var httpClient = new HttpClient(handler); 494using var httpClient = new HttpClient(handler); 989public HttpClient CreateClient(string name) => new(handler, disposeHandler: false);
Aspire.Hosting.Browsers (1)
BrowserEndpointDiscovery.cs (1)
31private static readonly HttpClient s_probeHttpClient = new()
Aspire.Hosting.Browsers.Tests (1)
src\Aspire.Hosting.Browsers\BrowserEndpointDiscovery.cs (1)
31private static readonly HttpClient s_probeHttpClient = new()
Aspire.Hosting.Foundry.Tests (2)
ToolboxTests.cs (2)
414using var client = new HttpClient(handler); 459using var client = new HttpClient(handler);
Aspire.Hosting.JavaScript.Tests (1)
AddDenoAppTests.cs (1)
2752using var httpClient = new HttpClient();
Aspire.Hosting.MongoDB.Tests (3)
MongoDbFunctionalTests.cs (1)
138using var httpClient = new HttpClient { BaseAddress = new Uri(endpoint.Url) };
ReplicaSet\MongoDbReplicaSetFunctionalTests.cs (2)
133using var httpClient = new HttpClient { BaseAddress = new Uri(endpoint.Url) }; 220using var httpClient = new HttpClient { BaseAddress = new Uri(mongoExpressEndpoint.Url) };
Aspire.Hosting.Seq.Tests (1)
SeqFunctionalTests.cs (1)
44HttpClient client = new()
Aspire.Hosting.Testing.Tests (4)
DashboardUrlTests.cs (4)
43using var httpClient = new HttpClient(handler) 179using var httpClient = new HttpClient(handler) 224using var httpClient = new HttpClient(handler) 269using var httpClient = new HttpClient { Timeout = TestConstants.LongTimeoutTimeSpan };
Aspire.Hosting.Tests (4)
DistributedApplicationTests.cs (4)
797using var clientB = new HttpClient(); 1744using var client2 = new HttpClient(new SocketsHttpHandler 1791using var client = new HttpClient(); 1811using var client = new HttpClient();
Aspire.Playground.Tests (1)
Infrastructure\DistributedApplicationExtensions.cs (1)
183var httpClient = new HttpClient
Aspire.Seq (1)
SeqHealthCheck.cs (1)
14private readonly HttpClient _client = new(new SocketsHttpHandler { ActivityHeadersPropagator = null }) { BaseAddress = new Uri(seqUri) };
Aspire.Templates.Tests (1)
StarterTemplateRunTestsBase.cs (1)
83using var httpClient = new HttpClient();
BlazorStandalone (1)
Program.cs (1)
21builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
dotnet-aot (2)
parent\dotnet\NugetSearch\NugetToolSearchApiRequest.cs (2)
28var httpClient = new HttpClient(); 97using var httpClient = new HttpClient();
dotnet-openapi (1)
Program.cs (1)
22using var httpClient = new HttpClientWrapper(new HttpClient());
dotnet-sourcelink (1)
dotnet-svcutil-lib (1)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\HttpChannelFactory.cs (1)
293httpClient = new HttpClient(clientHandler);
GenerateDocumentationAndConfigFiles (1)
Program.cs (1)
33private static readonly HttpClient httpClient = new();
Infrastructure.Common (3)
ServiceUtilHelper.cs (3)
579using (HttpClient httpClient = new HttpClient()) 598using (HttpClient httpClient = new HttpClient()) 617using (HttpClient httpClient = new HttpClient())
installer.tasks (1)
StaticFileRegeneration\RegenerateThirdPartyNotices.cs (1)
41using (var client = new HttpClient())
Microsoft.AspNetCore.Authentication.JwtBearer (1)
JwtBearerPostConfigureOptions.cs (1)
54options.Backchannel = new HttpClient(options.BackchannelHttpHandler ?? new HttpClientHandler());
Microsoft.AspNetCore.Authentication.OAuth (1)
OAuthPostConfigureOptions.cs (1)
38options.Backchannel = new HttpClient(options.BackchannelHttpHandler ?? new HttpClientHandler());
Microsoft.AspNetCore.Authentication.OpenIdConnect (1)
OpenIdConnectPostConfigureOptions.cs (1)
70options.Backchannel = new HttpClient(options.BackchannelHttpHandler ?? new HttpClientHandler());
Microsoft.AspNetCore.Authentication.Twitter (1)
TwitterPostConfigureOptions.cs (1)
48options.Backchannel = new HttpClient(options.BackchannelHttpHandler ?? new HttpClientHandler());
Microsoft.AspNetCore.Authentication.WsFederation (1)
WsFederationPostConfigureOptions.cs (1)
65options.Backchannel = new HttpClient(options.BackchannelHttpHandler ?? new HttpClientHandler());
Microsoft.AspNetCore.Components.Testing (2)
Infrastructure\ReadinessNotificationService.cs (1)
51using var client = new HttpClient();
Infrastructure\RemoteLock.cs (1)
41using var client = new HttpClient();
Microsoft.AspNetCore.Components.WebAssembly.Server (1)
TargetPickerUi.cs (1)
449using var httpClient = new HttpClient { Timeout = TimeSpan.FromSeconds(5) };
Microsoft.AspNetCore.Http.Connections.Client (1)
HttpConnection.cs (1)
654var httpClient = new HttpClient(httpMessageHandler);
Microsoft.AspNetCore.Mvc.Testing (2)
WebApplicationFactory.cs (2)
732client = new HttpClient(); 754client = new HttpClient(handlers[0]);
Microsoft.AspNetCore.Server.IntegrationTesting (2)
Common\DeploymentResult.cs (1)
65new HttpClient(new LoggingHandler(_loggerFactory, baseHandler))
Deployers\NginxDeployer.cs (1)
78using (var httpClient = new HttpClient())
Microsoft.AspNetCore.SpaProxy (1)
SpaProxyLaunchManager.cs (1)
96var httpClient = new HttpClient(new HttpClientHandler()
Microsoft.AspNetCore.SpaServices.Extensions (2)
AngularCli\AngularCliMiddleware.cs (1)
105using (var client = new HttpClient())
Proxying\SpaProxy.cs (1)
48return new HttpClient(handler)
Microsoft.AspNetCore.TestHost (1)
TestServer.cs (1)
183return new HttpClient(CreateHandler())
Microsoft.AspNetCore.Testing (3)
ServiceFakesHostExtensions.cs (3)
49return new HttpClient(httpHandler) { BaseAddress = uri }; 52return new HttpClient { BaseAddress = uri }; 55return new HttpClient(handler) { BaseAddress = uri };
Microsoft.AspNetCore.Testing.Tests (1)
FakesExtensionsTests.cs (1)
60var client = new HttpClient(new FakeCertificateHttpClientHandler(certificate))
Microsoft.AspNetCore.Watch.BrowserRefresh (1)
src\sdk\src\Dotnet.Watch\Web.Middleware\BrowserToolsForwarder.cs (1)
55_httpClient = new HttpClient(new SocketsHttpHandler
Microsoft.Build.Tasks.Core (1)
DownloadFile.cs (1)
154using (var client = new HttpClient(HttpMessageHandler ?? new HttpClientHandler(), disposeHandler: true) { Timeout = TimeSpan.FromMilliseconds(Timeout) })
Microsoft.Deployment.DotNet.Releases (1)
Utils.cs (1)
152s_httpClient = new HttpClient();
Microsoft.DotNet.Arcade.Sdk (1)
src\DownloadFile.cs (1)
171using (var httpClient = new HttpClient(handler))
Microsoft.DotNet.Cli.Telemetry (2)
Implementation\HttpTelemetryUploadTransport.cs (2)
21private static readonly HttpClient s_httpClient = new() { Timeout = System.Threading.Timeout.InfiniteTimeSpan }; 34: this(trackUri, new HttpClient(handler) { Timeout = System.Threading.Timeout.InfiniteTimeSpan })
Microsoft.Extensions.AI.Evaluation.Safety (1)
ContentSafetyService.cs (1)
25Interlocked.CompareExchange(ref field, new(), null) ??
Microsoft.Extensions.AI.OpenAI.Tests (192)
OpenAIChatClientTests.cs (23)
152using HttpClient httpClient = new(handler); 231using HttpClient httpClient = new(handler); 329using HttpClient httpClient = new(handler); 382using HttpClient httpClient = new(handler); 459using HttpClient httpClient = new(handler); 542using HttpClient httpClient = new(handler); 616using HttpClient httpClient = new(handler); 725using HttpClient httpClient = new(handler); 816using HttpClient httpClient = new(handler); 923using HttpClient httpClient = new(handler); 1019using HttpClient httpClient = new(handler); 1138using HttpClient httpClient = new(handler); 1223using HttpClient httpClient = new(handler); 1322using HttpClient httpClient = new(handler); 1462using HttpClient httpClient = new(handler); 1587using HttpClient httpClient = new(handler); 1634using HttpClient httpClient = new(handler); 1682using HttpClient httpClient = new(handler); 1728using HttpClient httpClient = new(handler); 1867using HttpClient httpClient = new(handler); 1912using HttpClient httpClient = new(handler); 1962using HttpClient httpClient = new(handler); 2030using HttpClient httpClient = new(handler);
OpenAIEmbeddingGeneratorTests.cs (5)
127using HttpClient httpClient = new(handler); 187using HttpClient httpClient = new(handler); 245using HttpClient httpClient = new(handler); 288using HttpClient httpClient = new(handler); 308using HttpClient httpClient = new(handler);
OpenAIHostedFileClientTests.cs (38)
108using HttpClient httpClient = new(handler); 145using HttpClient httpClient = new(handler); 159using HttpClient httpClient = new(); 168using HttpClient httpClient = new(); 177using HttpClient httpClient = new(); 198using HttpClient httpClient = new(handler); 217using HttpClient httpClient = new(handler); 228using HttpClient httpClient = new(); 237using HttpClient httpClient = new(); 257using HttpClient httpClient = new(handler); 294using HttpClient httpClient = new(handler); 315using HttpClient httpClient = new(handler); 337using HttpClient httpClient = new(handler); 349using HttpClient httpClient = new(handler); 360using HttpClient httpClient = new(); 369using HttpClient httpClient = new(); 378using HttpClient httpClient = new(); 389using HttpClient httpClient = new(); 399using HttpClient httpClient = new(); 409using HttpClient httpClient = new(); 419using HttpClient httpClient = new(); 429using HttpClient httpClient = new(); 440using HttpClient httpClient = new(); 450using HttpClient httpClient = new(); 460using HttpClient httpClient = new(); 470using HttpClient httpClient = new(); 587using HttpClient httpClient = new(handler); 621using HttpClient httpClient = new(handler); 658using HttpClient httpClient = new(handler); 683using HttpClient httpClient = new(handler); 713using HttpClient httpClient = new(handler); 740using HttpClient httpClient = new(handler); 755using HttpClient httpClient = new(handler); 782using HttpClient httpClient = new(handler); 806using HttpClient httpClient = new(handler); 818using HttpClient httpClient = new(handler); 843using HttpClient httpClient = new(handler); 867using HttpClient httpClient = new(handler);
OpenAIRequestPoliciesTests.cs (3)
89using var http = new HttpClient(handler); 105using var http = new HttpClient(handler); 121using var http = new HttpClient(handler);
OpenAIResponseClientTests.cs (102)
150using HttpClient httpClient = new(handler); 293using HttpClient httpClient = new(handler); 423using HttpClient httpClient = new(handler); 553using HttpClient httpClient = new(handler); 655using HttpClient httpClient = new(handler); 729using HttpClient httpClient = new(handler); 849using HttpClient httpClient = new(handler); 989using HttpClient httpClient = new(handler); 1084using HttpClient httpClient = new(handler); 1191using HttpClient httpClient = new(handler); 1336using HttpClient httpClient = new(handler); 1464using HttpClient httpClient = new(handler); 1598using (HttpClient httpClient = new(handler)) 1719using (HttpClient httpClient = new(handler)) 1858using HttpClient httpClient = new(handler); 2086using HttpClient httpClient = new(handler); 2499using HttpClient httpClient = new(handler); 2706using HttpClient httpClient = new(handler); 2817using HttpClient httpClient = new(handler); 2907using HttpClient httpClient = new(handler); 2979using HttpClient httpClient = new(handler); 3068using HttpClient httpClient = new(handler); 3120using HttpClient httpClient = new(handler); 3215using HttpClient httpClient = new(handler); 3296using HttpClient httpClient = new(handler); 3363using HttpClient httpClient = new(handler); 3487using HttpClient httpClient = new(handler); 3707using HttpClient httpClient = new(handler); 3794using HttpClient httpClient = new(handler); 3863using HttpClient httpClient = new(handler); 3915using HttpClient httpClient = new(handler); 3973using HttpClient httpClient = new(handler); 4032using HttpClient httpClient = new(handler); 4093using HttpClient httpClient = new(handler); 4155using HttpClient httpClient = new(handler); 4218using HttpClient httpClient = new(handler); 4291using HttpClient httpClient = new(handler); 4372using HttpClient httpClient = new(handler); 4443using HttpClient httpClient = new(handler); 4513using HttpClient httpClient = new(handler); 4590using HttpClient httpClient = new(handler); 4668using HttpClient httpClient = new(handler); 4734using HttpClient httpClient = new(handler); 4795using HttpClient httpClient = new(handler); 4865using HttpClient httpClient = new(handler); 4924using HttpClient httpClient = new(handler); 4980using HttpClient httpClient = new(handler); 5041using HttpClient httpClient = new(handler); 5099using HttpClient httpClient = new(handler); 5156using HttpClient httpClient = new(handler); 5215using HttpClient httpClient = new(handler); 5277using HttpClient httpClient = new(handler); 5333using HttpClient httpClient = new(handler); 5388using HttpClient httpClient = new(handler); 5445using HttpClient httpClient = new(handler); 5502using HttpClient httpClient = new(handler); 5539using HttpClient httpClient = new(handler); 5571using HttpClient httpClient = new(handler); 5615using HttpClient httpClient = new(handler); 5668using HttpClient httpClient = new(handler); 5723using HttpClient httpClient = new(handler); 5761using HttpClient httpClient = new(handler); 5796using HttpClient httpClient = new(handler); 5831using HttpClient httpClient = new(handler); 5866using HttpClient httpClient = new(handler); 5904using HttpClient httpClient = new(handler); 5942using HttpClient httpClient = new(handler); 5962using HttpClient httpClient = new(); 6000using HttpClient httpClient = new(handler); 6043using HttpClient httpClient = new(handler); 6086using HttpClient httpClient = new(handler); 6129using HttpClient httpClient = new(handler); 6204using HttpClient httpClient = new(handler); 6276using HttpClient httpClient = new(handler); 6317using HttpClient httpClient = new(handler); 6371using HttpClient httpClient = new(handler); 6434using HttpClient httpClient = new(handler); 6507using HttpClient httpClient = new(handler); 6607using HttpClient httpClient = new(handler); 6724using HttpClient httpClient = new(handler); 6854using HttpClient httpClient = new(handler); 6918using HttpClient httpClient = new(handler); 6993using HttpClient httpClient = new(handler); 7275using HttpClient httpClient = new(handler); 7402using HttpClient httpClient = new(handler); 7512using HttpClient httpClient = new(handler); 7596using HttpClient httpClient = new(handler); 7688using HttpClient httpClient = new(handler); 7758using HttpClient httpClient = new(handler); 7864using HttpClient httpClient = new(handler); 7965using HttpClient httpClient = new(handler); 8070using HttpClient httpClient = new(handler); 8170using HttpClient httpClient = new(handler); 8257using HttpClient httpClient = new(handler); 8348using HttpClient httpClient = new(handler); 8433using HttpClient httpClient = new(handler); 8546using HttpClient httpClient = new(handler); 8645using HttpClient httpClient = new(handler); 8750using HttpClient httpClient = new(handler); 8863using HttpClient httpClient = new(handler); 8968using HttpClient httpClient = new(handler); 9061using HttpClient httpClient = new(handler);
OpenAISpeechToTextClientTests.cs (12)
86using HttpClient httpClient = new(handler); 107using HttpClient httpClient = new(); 121using HttpClient httpClient = new(); 161using HttpClient httpClient = new(handler); 196using HttpClient httpClient = new(handler); 233using HttpClient httpClient = new(handler); 270using HttpClient httpClient = new(handler); 312using HttpClient httpClient = new(handler); 399using HttpClient httpClient = new(handler); 430using HttpClient httpClient = new(handler); 463using HttpClient httpClient = new(handler); 496using HttpClient httpClient = new(handler);
OpenAITextToSpeechClientTests.cs (9)
78using HttpClient httpClient = new(handler); 106using HttpClient httpClient = new(handler); 135using HttpClient httpClient = new(handler); 168using HttpClient httpClient = new(handler); 198using HttpClient httpClient = new(handler); 221using HttpClient httpClient = new(); 234using HttpClient httpClient = new(); 262using HttpClient httpClient = new(handler); 307using HttpClient httpClient = new(handler);
Microsoft.Extensions.DataIngestion.Tests (1)
Readers\DocumentReaderConformanceTests.cs (1)
17private static readonly HttpClient _httpClient = new() { Timeout = TimeSpan.FromSeconds(30) };
Microsoft.Extensions.Http (1)
DefaultHttpClientFactory.cs (1)
108var client = new HttpClient(handler, disposeHandler: false);
Microsoft.Extensions.Http.Diagnostics.Tests (17)
Latency\Internal\HttpLatencyMediatorTests.cs (1)
82using var client = new HttpClient(handler);
Latency\Internal\HttpLatencyTelemetryHandlerTest.cs (1)
80using var client = new HttpClient(handler);
Logging\HttpClientLoggerTest.cs (15)
70using var client = new HttpClient(handler); 105using var client = new HttpClient(handler); 148using var httpClient = new HttpClient(handler); 237using var client = new HttpClient(handler); 277using var client = new HttpClient(handler); 363using var client = new HttpClient(handler); 467using var client = new HttpClient(handler); 583using var client = new HttpClient(handler); 677using var client = new HttpClient(handler); 721using var client = new HttpClient(handler); 764using var client = new HttpClient(handler); 802using var client = new HttpClient(handler); 846using var client = new HttpClient(handler); 952using var client = new HttpClient(handler); 993using var client = new HttpClient(handler);
Microsoft.Extensions.Logging.AzureAppServices (1)
BlobLoggerProvider.cs (1)
52_httpClient = new HttpClient();
Microsoft.Extensions.ML (2)
ModelLoaders\UriModelLoader.cs (2)
107using (var client = new HttpClient()) 141using (var client = new HttpClient())
Microsoft.Maui.Controls (1)
UriImageSource.cs (1)
117 using var client = new HttpClient();
Microsoft.ML.AutoML.Tests (1)
DatasetUtil.cs (1)
208using (var client = new HttpClient())
Microsoft.ML.Core (1)
Utilities\ResourceManagerUtils.cs (1)
157using (var client = new HttpClient())
Microsoft.ML.PerformanceTests (1)
ImageClassificationBench.cs (1)
159using (HttpClient client = new HttpClient())
Microsoft.ML.Samples (5)
Dynamic\TensorFlow\ImageClassification.cs (1)
123using (HttpClient client = new HttpClient())
Dynamic\Trainers\MulticlassClassification\ImageClassification\ImageClassificationDefault.cs (1)
272using (HttpClient client = new HttpClient())
Dynamic\Trainers\MulticlassClassification\ImageClassification\LearningRateSchedulingCifarResnetTransferLearning.cs (1)
304using (HttpClient client = new HttpClient())
Dynamic\Trainers\MulticlassClassification\ImageClassification\ResnetV2101TransferLearningEarlyStopping.cs (1)
260using (HttpClient client = new HttpClient())
Dynamic\Trainers\MulticlassClassification\ImageClassification\ResnetV2101TransferLearningTrainTestSplit.cs (1)
281using (HttpClient client = new HttpClient())
Microsoft.ML.Samples.GPU (5)
parent\6a273e5f1a281752\LearningRateSchedulingCifarResnetTransferLearning.cs (1)
304using (HttpClient client = new HttpClient())
parent\Microsoft.ML.Samples\Dynamic\TensorFlow\ImageClassification.cs (1)
123using (HttpClient client = new HttpClient())
parent\Microsoft.ML.Samples\Dynamic\Trainers\MulticlassClassification\ImageClassification\ImageClassificationDefault.cs (1)
272using (HttpClient client = new HttpClient())
parent\Microsoft.ML.Samples\Dynamic\Trainers\MulticlassClassification\ImageClassification\ResnetV2101TransferLearningEarlyStopping.cs (1)
260using (HttpClient client = new HttpClient())
parent\Microsoft.ML.Samples\Dynamic\Trainers\MulticlassClassification\ImageClassification\ResnetV2101TransferLearningTrainTestSplit.cs (1)
281using (HttpClient client = new HttpClient())
Microsoft.ML.SamplesUtils (1)
SamplesDatasetUtils.cs (1)
196using (HttpClient client = new HttpClient())
Microsoft.ML.TestFrameworkCommon (1)
TestDownloadUtils.cs (1)
21using (var client = new HttpClient { Timeout = Timeout.InfiniteTimeSpan })
Microsoft.ML.Tokenizers.Data.Tests (1)
parent\Microsoft.ML.Tokenizers.Tests\Utils.cs (1)
17using (var client = new HttpClient() { Timeout = TimeSpan.FromMinutes(5) })
Microsoft.ML.Tokenizers.Tests (2)
LlamaTests.cs (1)
21private static readonly HttpClient _httpClient = new HttpClient() { Timeout = TimeSpan.FromMinutes(5) };
Utils.cs (1)
17using (var client = new HttpClient() { Timeout = TimeSpan.FromMinutes(5) })
Microsoft.NET.Build.Containers (1)
Registry\DefaultRegistryAPI.cs (1)
48HttpClient client = new(clientHandler)
Microsoft.NET.Sdk.Publish.Tasks (3)
Kudu\KuduVfsDeploy.cs (1)
59using (var client = new HttpClient())
Kudu\KuduZipDeploy.cs (1)
50using (var client = new HttpClient())
Tasks\Http\DefaultHttpClient.cs (1)
11private readonly HttpClient _httpClient = new()
Microsoft.TemplateSearch.Common (1)
Providers\NuGetMetadataSearchProvider.cs (1)
177using HttpClient client = new(handler);
NuGet.Packaging (1)
Signing\Timestamp\Rfc3161TimestampRequestNetstandard21Wrapper.cs (1)
17private static readonly HttpClient HttpClient = new HttpClient();
NuGet.Protocol (1)
HttpSource\HttpSource.cs (1)
397var httpClient = new HttpClient(httpHandler.MessageHandler)
Pipelines.Library (1)
DistributedApplicationPipelineExtensions.cs (1)
148using var httpClient = new HttpClient();
System.Net.Requests (1)
System\Net\HttpWebRequest.cs (1)
1692client = new HttpClient(handler);
System.Private.Xml (1)
System\Xml\XmlDownloadManager.cs (1)
43using (var client = new HttpClient(handler))
System.ServiceModel.Http (1)
System\ServiceModel\Channels\HttpChannelFactory.cs (1)
346httpClient = new HttpClient(handler);
System.Windows.Forms (2)
System\Windows\Forms\Controls\PictureBox\PictureBox.cs (2)
28private static readonly HttpClient s_httpClient = !AppContextSwitches.ServicePointManagerCheckCrl ? new() : 29new(new HttpClientHandler { CheckCertificateRevocationList = true });
1122 references to HttpClient
aspire (44)
Agents\AspireSkills\AspireSkillsInstaller.cs (3)
175var httpClient = httpClientFactory.CreateClient(); 427private async Task<GitHubReleaseInfo?> TryGetGitHubReleaseAsync(HttpClient httpClient, string version, CancellationToken cancellationToken) 529private static async Task<bool> TryDownloadGitHubAssetAsync(HttpClient httpClient, string downloadUrl, string archivePath, CancellationToken cancellationToken)
Agents\AspireSkills\GitHubArtifactAttestationVerifier.cs (1)
28internal sealed class GitHubArtifactAttestationVerifier(HttpClient httpClient, ILogger<GitHubArtifactAttestationVerifier> logger) : IGitHubArtifactAttestationVerifier
Commands\ExportCommand.cs (3)
145using var client = isDashboardAvailable ? TelemetryCommandHelpers.CreateApiClient(_httpClientFactory, apiToken!) : null; 288HttpClient client, 319HttpClient client,
Commands\TelemetryCommandHelpers.cs (5)
310public static HttpClient CreateApiClient(IHttpClientFactory factory, string apiToken) 312var client = factory.CreateClient(); 376using var probeClient = httpClientFactory.CreateClient(); 440using var client = httpClientFactory.CreateClient(); 504public static async Task<ResourceInfoJson[]> GetAllResourcesAsync(HttpClient client, string baseUrl, CancellationToken cancellationToken)
Commands\TelemetryLogsCommand.cs (3)
127using var client = TelemetryCommandHelpers.CreateApiClient(_httpClientFactory, apiToken); 166private async Task<int> GetLogsSnapshotAsync(HttpClient client, string url, OutputFormat format, IReadOnlyList<IOtlpResource> allResources, string dashboardUrl, CancellationToken cancellationToken) 188private async Task<int> StreamLogsAsync(HttpClient client, string url, OutputFormat format, IReadOnlyList<IOtlpResource> allResources, string dashboardUrl, CancellationToken cancellationToken)
Commands\TelemetrySpansCommand.cs (3)
117using var client = TelemetryCommandHelpers.CreateApiClient(_httpClientFactory, apiToken); 158private async Task<int> GetSpansSnapshotAsync(HttpClient client, string url, OutputFormat format, IReadOnlyList<IOtlpResource> allResources, string dashboardUrl, CancellationToken cancellationToken) 180private async Task<int> StreamSpansAsync(HttpClient client, string url, OutputFormat format, IReadOnlyList<IOtlpResource> allResources, string dashboardUrl, CancellationToken cancellationToken)
Commands\TelemetryTracesCommand.cs (2)
124using var client = TelemetryCommandHelpers.CreateApiClient(_httpClientFactory, apiToken); 185using var client = TelemetryCommandHelpers.CreateApiClient(_httpClientFactory, apiToken);
Documentation\ApiDocs\ApiDocsFetcher.cs (2)
28internal sealed class ApiDocsFetcher(HttpClient httpClient, IApiDocsCache cache, IConfiguration configuration, ILogger<ApiDocsFetcher> logger) : IApiDocsFetcher 30private readonly HttpClient _httpClient = httpClient;
Documentation\CachedHttpDocumentFetcher.cs (2)
26HttpClient httpClient, 110HttpClient httpClient,
Documentation\Docs\DocsFetcher.cs (2)
26internal sealed class DocsFetcher(HttpClient httpClient, IDocsCache cache, IConfiguration configuration, ILogger<DocsFetcher> logger) : IDocsFetcher 28private readonly HttpClient _httpClient = httpClient;
Mcp\Tools\ListStructuredLogsTool.cs (1)
68using var client = TelemetryCommandHelpers.CreateApiClient(httpClientFactory, apiToken);
Mcp\Tools\ListTracesTool.cs (1)
68using var client = TelemetryCommandHelpers.CreateApiClient(httpClientFactory, apiToken);
Mcp\Tools\ListTraceStructuredLogsTool.cs (1)
78using var client = TelemetryCommandHelpers.CreateApiClient(httpClientFactory, apiToken);
Npm\SigstoreNpmProvenanceChecker.cs (3)
28private readonly HttpClient _httpClient; 39HttpClient httpClient, 46HttpClient httpClient,
Profiling\ProfileCaptureService.cs (2)
289using var client = _httpClientFactory.CreateClient(); 450using var client = _httpClientFactory.CreateClient();
Telemetry\InternalMicrosoftDetector.cs (7)
856using var http = CreateGitHubHttpClient(); 965using var http = CreateGitHubHttpClient(); 1010using var http = CreateGitHubHttpClient(); 1016using var http = CreateGitHubHttpClient(); 1020private static async Task<GitHubMembershipCheckResult> CheckGitHubMembershipWithTokenAsync(HttpClient http, string token, CancellationToken cancellationToken) 1097private HttpClient CreateGitHubHttpClient() 1099var http = _gitHubHttpMessageHandler is null
Utils\CliDownloader.cs (1)
30private static readonly HttpClient s_httpClient = new();
Utils\EnvironmentChecker\DcpConnectionChecker.cs (2)
52using var client = new HttpClient(handler) 323public async Task StopDcpAsync(HttpClient client, DcpKubeconfig kubeconfig, CancellationToken cancellationToken)
Aspire.Acquisition.Tests (1)
Scripts\Common\ScriptHostFixture.cs (1)
78using var client = new HttpClient();
Aspire.Cli.EndToEnd.Tests (2)
Helpers\CliE2ETestHelpers.cs (1)
621private static readonly HttpClient s_nuGetHttpClient = new() { Timeout = TimeSpan.FromSeconds(30) };
RepositoryToolUpdateTests.cs (1)
230using var httpClient = new HttpClient { Timeout = TimeSpan.FromSeconds(30) };
Aspire.Cli.Tests (32)
Agents\SigstoreNpmProvenanceCheckerTests.cs (1)
1195using var httpClient = new HttpClient(handler);
Mcp\ApiDocs\ApiDocsCacheTests.cs (2)
34using var httpClient = new HttpClient(handler); 60using var httpClient = new HttpClient(handler);
Mcp\ApiDocs\ApiDocsFetcherTests.cs (4)
17private static ApiDocsFetcher CreateFetcher(HttpClient httpClient, IApiDocsCache cache, IConfiguration? configuration = null) 38using var httpClient = new HttpClient(handler); 64using var httpClient = new HttpClient(handler); 91using var httpClient = new HttpClient(handler);
Mcp\Docs\DocsCacheTests.cs (1)
32using var httpClient = new HttpClient(handler);
Mcp\Docs\DocsFetcherTests.cs (18)
17private static DocsFetcher CreateFetcher(HttpClient httpClient, IDocsCache cache, IConfiguration? configuration = null) 40using var httpClient = new HttpClient(handler); 60using var httpClient = new HttpClient(handler); 81using var httpClient = new HttpClient(handler); 108using var httpClient = new HttpClient(handler); 130using var httpClient = new HttpClient(handler); 165using var httpClient = new HttpClient(handler); 183using var httpClient = new HttpClient(handler); 196using var httpClient = new HttpClient(handler); 209using var httpClient = new HttpClient(handler); 230using var httpClient = new HttpClient(handler); 250using var httpClient = new HttpClient(handler); 269using var httpClient = new HttpClient(handler); 292using var httpClient = new HttpClient(handler); 313using var httpClient = new HttpClient(handler); 333using var httpClient = new HttpClient(handler); 366using var httpClient = new HttpClient(handler); 384using var httpClient = new HttpClient(handler);
Telemetry\AgentTelemetryPersistenceTests.cs (4)
125using var client = new HttpClient(handler); 164using var client = new HttpClient(handler); 172private static TracerProvider CreateRecoveryProvider(string storage, HttpClient client) 232using var httpClient = new HttpClient(handler);
TestServices\TestHttpClientFactory.cs (1)
11public HttpClient CreateClient(string name)
Utils\MockHttpClientFactory.cs (1)
17public HttpClient CreateClient(string name)
Aspire.Dashboard (10)
Model\DebugSessionHelpers.cs (2)
13public static HttpClient CreateHttpClient(Uri? debugSessionUri, string? token, X509Certificate2? cert, Func<HttpClientHandler, HttpMessageHandler>? createHandler, string? dcpInstanceId = null) 38var client = new HttpClient(resolvedHandler)
Telemetry\DashboardTelemetrySender.cs (6)
18private readonly Channel<(OperationContext, Func<HttpClient, Func<OperationContextProperty, object>, Task>)> _channel; 23internal HttpClient? Client { get; private set; } 38_channel = Channel.CreateBounded<(OperationContext, Func<HttpClient, Func<OperationContextProperty, object>, Task>)>(channelOptions); 115internal bool TryCreateHttpClient([NotNullWhen(true)] out HttpClient? client) 133if (!TryCreateHttpClient(out var client)) 163public void QueueRequest(OperationContext context, Func<HttpClient, Func<OperationContextProperty, object>, Task> requestFunc)
Telemetry\DashboardTelemetryService.cs (1)
402HttpClient client,
Telemetry\IDashboardTelemetrySender.cs (1)
12public void QueueRequest(OperationContext context, Func<HttpClient, Func<OperationContextProperty, object>, Task> requestFunc);
Aspire.Dashboard.Components.Tests (1)
tests\Shared\TestDashboardTelemetrySender.cs (1)
21public void QueueRequest(OperationContext context, Func<HttpClient, Func<OperationContextProperty, object>, Task> requestFunc)
Aspire.Dashboard.Tests (74)
Integration\BlazorWebSocketOriginTests.cs (1)
23using var client = new HttpClient { BaseAddress = frontendUri };
Integration\FrontendBrowserTokenAuthTests.cs (10)
40using var client = new HttpClient { BaseAddress = new Uri($"http://{app.FrontendSingleEndPointAccessor().EndPoint}") }; 62using var client = new HttpClient { BaseAddress = new Uri($"http://{app.FrontendSingleEndPointAccessor().EndPoint}") }; 105using var client = new HttpClient(handler); 152using var client = new HttpClient(handler); 192using var client = new HttpClient(handler); 235using var client = new HttpClient(new HttpClientHandler { AllowAutoRedirect = true, UseCookies = true }) 269using var client = new HttpClient(handler) 298using var client = new HttpClient { BaseAddress = new Uri($"http://{app.OtlpServiceHttpEndPointAccessor().EndPoint}") }; 322using var client = new HttpClient { BaseAddress = new Uri($"http://{app.FrontendSingleEndPointAccessor().EndPoint}") }; 347using var client = new HttpClient { BaseAddress = new Uri($"http://{app.FrontendSingleEndPointAccessor().EndPoint}") };
Integration\FrontendOpenIdConnectAuthTests.cs (2)
36using var client = new HttpClient(handler) { BaseAddress = new Uri($"http://{app.FrontendSingleEndPointAccessor().EndPoint}") }; 81using var client = new HttpClient(handler) { BaseAddress = new Uri($"http://{app.OtlpServiceHttpEndPointAccessor().EndPoint}") };
Integration\HealthTests.cs (2)
30using var client = new HttpClient(httpClientHandler) { BaseAddress = new Uri(basePath) }; 52using var client = new HttpClient { BaseAddress = new Uri($"http://{fixture.App.FrontendSingleEndPointAccessor().EndPoint}") };
Integration\IntegrationTestHelpers.cs (1)
114public static HttpClient CreateHttpClient(
Integration\OtlpCorsHttpServiceTests.cs (4)
27using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.OtlpServiceHttpEndPointAccessor().EndPoint}"); 51using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.OtlpServiceHttpEndPointAccessor().EndPoint}"); 92using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.OtlpServiceHttpEndPointAccessor().EndPoint}"); 120using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.OtlpServiceHttpEndPointAccessor().EndPoint}");
Integration\OtlpGrpcServiceTests.cs (1)
255using var httpClient = IntegrationTestHelpers.CreateHttpClient($"https://{app.FrontendSingleEndPointAccessor().EndPoint}");
Integration\OtlpHttpJsonTests.cs (9)
505using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.OtlpServiceHttpEndPointAccessor().EndPoint}"); 565using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.OtlpServiceHttpEndPointAccessor().EndPoint}"); 642using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.OtlpServiceHttpEndPointAccessor().EndPoint}"); 692using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.OtlpServiceHttpEndPointAccessor().EndPoint}"); 744using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.OtlpServiceHttpEndPointAccessor().EndPoint}"); 834using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.OtlpServiceHttpEndPointAccessor().EndPoint}"); 862using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.OtlpServiceHttpEndPointAccessor().EndPoint}"); 880using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.OtlpServiceHttpEndPointAccessor().EndPoint}"); 898using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.OtlpServiceHttpEndPointAccessor().EndPoint}");
Integration\OtlpHttpServiceTests.cs (13)
43using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.OtlpServiceHttpEndPointAccessor().EndPoint}"); 72using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.OtlpServiceHttpEndPointAccessor().EndPoint}"); 124using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.OtlpServiceHttpEndPointAccessor().EndPoint}"); 195using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.OtlpServiceHttpEndPointAccessor().EndPoint}"); 222using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.OtlpServiceHttpEndPointAccessor().EndPoint}"); 250using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.OtlpServiceHttpEndPointAccessor().EndPoint}"); 284using var httpClient = IntegrationTestHelpers.CreateHttpClient($"https://{app.FrontendSingleEndPointAccessor().EndPoint}", 315using var client = new HttpClient { BaseAddress = new Uri($"http://{endpoint.EndPoint}") }; 346using var client = new HttpClient { BaseAddress = new Uri($"http://{endpoint.EndPoint}") }; 393using var client = new HttpClient { BaseAddress = new Uri($"http://{endpoint.EndPoint}") }; 418using var client = new HttpClient { BaseAddress = new Uri($"http://{endpoint.EndPoint}") }; 447using var client = new HttpClient { BaseAddress = new Uri($"http://{endpoint.EndPoint}") }; 476using var client = new HttpClient { BaseAddress = new Uri($"http://{endpoint.EndPoint}") };
Integration\Playwright\NativeAotDashboardTests.cs (2)
153using var client = new HttpClient { BaseAddress = new Uri(otlpUrl) }; 171using var client = new HttpClient();
Integration\ResponseCompressionTests.cs (2)
22using var client = new HttpClient(httpClientHandler) { BaseAddress = new Uri($"http://{app.FrontendSingleEndPointAccessor().EndPoint}") }; 45using var client = new HttpClient(httpClientHandler) { BaseAddress = new Uri($"http://{app.FrontendSingleEndPointAccessor().EndPoint}") };
Integration\StartupTests.cs (5)
425using var httpClient = new HttpClient(new HttpClientHandler 532using var httpClient = new HttpClient() 814using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.FrontendSingleEndPointAccessor().EndPoint}"); 961using var client = new HttpClient { BaseAddress = new Uri($"http://{app.FrontendSingleEndPointAccessor().EndPoint}") }; 1038using var client = new HttpClient { BaseAddress = new Uri($"http://{endpointString}") };
Integration\TelemetryApiTests.cs (20)
64using var httpClient = new HttpClient(handler) { BaseAddress = new Uri($"http://{app.FrontendSingleEndPointAccessor().EndPoint}") }; 84using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.FrontendSingleEndPointAccessor().EndPoint}"); 109using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.FrontendSingleEndPointAccessor().EndPoint}"); 136using var httpClient = new HttpClient(handler) { BaseAddress = new Uri($"http://{app.FrontendSingleEndPointAccessor().EndPoint}") }; 158using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.FrontendSingleEndPointAccessor().EndPoint}"); 180using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.FrontendSingleEndPointAccessor().EndPoint}"); 202using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.FrontendSingleEndPointAccessor().EndPoint}"); 223using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.FrontendSingleEndPointAccessor().EndPoint}"); 242using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.FrontendSingleEndPointAccessor().EndPoint}"); 263using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.FrontendSingleEndPointAccessor().EndPoint}"); 283using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.FrontendSingleEndPointAccessor().EndPoint}"); 307using var httpClient = new HttpClient(handler) { BaseAddress = new Uri($"http://{app.FrontendSingleEndPointAccessor().EndPoint}") }; 332using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.FrontendSingleEndPointAccessor().EndPoint}"); 352using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.FrontendSingleEndPointAccessor().EndPoint}"); 383using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.FrontendSingleEndPointAccessor().EndPoint}"); 416using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.FrontendSingleEndPointAccessor().EndPoint}"); 438using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.FrontendSingleEndPointAccessor().EndPoint}"); 460using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.FrontendSingleEndPointAccessor().EndPoint}"); 479using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.FrontendSingleEndPointAccessor().EndPoint}"); 501using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.FrontendSingleEndPointAccessor().EndPoint}");
Telemetry\DashboardTelemetrySenderTests.cs (1)
126Assert.True(telemetrySender.TryCreateHttpClient(out var client));
tests\Shared\TestDashboardTelemetrySender.cs (1)
21public void QueueRequest(OperationContext context, Func<HttpClient, Func<OperationContextProperty, object>, Task> requestFunc)
Aspire.Deployment.EndToEnd.Tests (10)
AcaExpressDeploymentTests.cs (4)
55using var managementClient = new HttpClient(); 252HttpClient client, TokenCredential credential, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken) 317HttpClient client, TokenCredential credential, string url, CancellationToken cancellationToken) 347using var client = new HttpClient(handler) { Timeout = TimeSpan.FromSeconds(75) };
FoundryDotnetProjectDeploymentTests.cs (1)
164using var http = new HttpClient();
FoundryHostedAgentDeploymentTests.cs (4)
234using var client = new HttpClient(); 292using var client = new HttpClient(); 462using var client = new HttpClient(); 573HttpClient client,
Helpers\DotnetProjectDeploymentHelpers.cs (1)
72using var client = new HttpClient(handler) { Timeout = TimeSpan.FromSeconds(15) };
Aspire.EndToEnd.Tests (3)
tests\Shared\TemplatesTesting\AspireProject.cs (2)
25public static Lazy<HttpClient> Client => new(CreateHttpClient); 503private static HttpClient CreateHttpClient()
tests\Shared\TemplatesTesting\ProjectInfo.cs (1)
13public HttpClient Client { get; set; } = default!;
Aspire.Hosting (21)
ApplicationModel\HttpCommandContext.cs (2)
46public required HttpClient HttpClient { get; init; } 133public required HttpClient HttpClient { get; init; }
ApplicationModel\HttpCommandOptions.cs (2)
53/// When this property is <see langword="null"/>, the default <see cref="HttpClient"/> is used and its <see cref="HttpClient.Timeout"/>
Backchannel\AuxiliaryBackchannelRpcTarget.cs (1)
1944var httpClient = httpClientFactory?.CreateClient() ?? new HttpClient();
ExternalServiceBuilderExtensions.cs (7)
345public static async Task<HealthCheckResult> CheckUriAsync(Uri uri, int expectedStatusCode, Func<HttpClient> httpClientFactory, HealthCheckContext context, CancellationToken cancellationToken) 372private readonly Func<HttpClient> _httpClientFactory; 374public StaticUriHealthCheck(Uri uri, int expectedStatusCode, Func<HttpClient> httpClientFactory) 393private readonly Func<HttpClient> _httpClientFactory; 397public ParameterUriHealthCheck(ParameterResource urlParameter, string? path, int expectedStatusCode, Func<HttpClient> httpClientFactory) 459private readonly Func<HttpClient> _httpClientFactory; 461public EndpointUriHealthCheck(EndpointReference endpoint, string path, int expectedStatusCode, Func<HttpClient> httpClientFactory)
ResourceBuilderExtensions.cs (9)
3670/// Specifying <see cref="HttpCommandOptions.HttpClientName"/> will use that named <see cref="HttpClient"/> when sending the request. This allows you to configure the <see cref="HttpClient"/> 3672/// If <see cref="HttpCommandOptions.HttpClientName"/> is not specified, the default <see cref="HttpClient"/> will be used and its 3673/// <see cref="HttpClient.Timeout"/> will be set to <see cref="Timeout.InfiniteTimeSpan"/>. Specify a named client to preserve its configured timeout. 3764/// Specifying a <see cref="HttpCommandOptions.HttpClientName"/> will use that named <see cref="HttpClient"/> when sending the request. This allows you to configure the <see cref="HttpClient"/> 3766/// If <see cref="HttpCommandOptions.HttpClientName"/> is not specified, the default <see cref="HttpClient"/> will be used and its 3767/// <see cref="HttpClient.Timeout"/> will be set to <see cref="Timeout.InfiniteTimeSpan"/>. Specify a named client to preserve its configured timeout. 3837var httpClient = context.Services.GetRequiredService<IHttpClientFactory>().CreateClient(commandOptions.HttpClientName ?? Options.DefaultName);
Aspire.Hosting.Azure (1)
AcrLoginService.cs (1)
148var httpClient = _httpClientFactory.CreateClient("AcrLogin");
Aspire.Hosting.Azure.Sandboxes (1)
Internal\Adc\AzureDevComputeClient.cs (1)
40internal sealed class AzureDevComputeClient(HttpClient httpClient, TokenCredential credential, ILogger logger, TimeSpan? retryDelay = null) : IAzureDevComputeClient
Aspire.Hosting.Azure.Tests (9)
AcrLoginServiceTests.cs (1)
130public HttpClient CreateClient(string name) => new(handler, disposeHandler: false);
AzureSandboxesTests.cs (1)
3647public HttpClient CreateClient(string name)
FoundryExtensionsTests.cs (7)
415using var httpClient = new HttpClient(handler); 448using var httpClient = new HttpClient(handler); 470using var httpClient = new HttpClient(handler); 494using var httpClient = new HttpClient(handler); 574using var serviceHealthClient = httpClientFactory.CreateClient(nameof(FoundryLocalHealthCheck)); 575using var modelHealthClient = httpClientFactory.CreateClient(nameof(LocalModelHealthCheck)); 989public HttpClient CreateClient(string name) => new(handler, disposeHandler: false);
Aspire.Hosting.Browsers (1)
BrowserEndpointDiscovery.cs (1)
31private static readonly HttpClient s_probeHttpClient = new()
Aspire.Hosting.Browsers.Tests (1)
src\Aspire.Hosting.Browsers\BrowserEndpointDiscovery.cs (1)
31private static readonly HttpClient s_probeHttpClient = new()
Aspire.Hosting.Containers.Tests (6)
WithDockerfileTests.cs (6)
44using var client = app.CreateHttpClient("testcontainer", "http"); 76using var client = app.CreateHttpClient("testcontainer", "http"); 210using var client = app.CreateHttpClient("testcontainer", "http"); 244using var client = app.CreateHttpClient("testcontainer", "http"); 480using var client = app.CreateHttpClient("testcontainer", "http"); 551using var client = app.CreateHttpClient("testcontainer", "http");
Aspire.Hosting.Foundry (6)
FoundryLocalHealthCheck.cs (1)
20using var httpClient = httpClientFactory.CreateClient(nameof(FoundryLocalHealthCheck));
FoundryLocalService.cs (2)
110public static Task<bool> IsModelLoadedAsync(Uri endpoint, string modelId, HttpClient httpClient, CancellationToken cancellationToken) 125HttpClient httpClient,
LocalModelHealthCheck.cs (1)
24using var httpClient = httpClientFactory.CreateClient(nameof(LocalModelHealthCheck));
Toolbox\FoundryToolboxReadinessProbe.cs (1)
11HttpClient client,
Toolbox\FoundryToolboxResource.cs (1)
437var client = context.Services.GetRequiredService<IHttpClientFactory>().CreateClient();
Aspire.Hosting.Foundry.Tests (2)
ToolboxTests.cs (2)
414using var client = new HttpClient(handler); 459using var client = new HttpClient(handler);
Aspire.Hosting.JavaScript.Tests (11)
AddDenoAppTests.cs (1)
2752using var httpClient = new HttpClient();
BunFunctionalTests.cs (2)
24using var bunClient = _bunFixture.App.CreateHttpClient(_bunFixture.BunAppBuilder!.Resource.Name, "http"); 34using var bunClient = _bunFixture.App.CreateHttpClient(_bunFixture.BunScriptBuilder!.Resource.Name, "http");
DenoFunctionalTests.cs (5)
28using var denoClient = _denoFixture.App.CreateHttpClient(_denoFixture.DenoAppBuilder!.Resource.Name, "http"); 38using var denoClient = _denoFixture.App.CreateHttpClient(_denoFixture.DenoScriptBuilder!.Resource.Name, "http"); 55using var denoClient = denoFixture.App.CreateHttpClient(resourceName, "http"); 65using var dashboardClient = app.CreateHttpClient(DenoTelemetryFixture.AspireDashboardResourceName, "http"); 90private static async Task<int> GetTelemetryCountAsync(HttpClient client, string requestUri, CancellationToken cancellationToken)
NodeAppFixture.cs (1)
109using var client = App.CreateHttpClient(NodeAppBuilder!.Resource.Name, endpointName: "http");
NodeFunctionalTests.cs (2)
24using var nodeClient = _nodeJsFixture.App.CreateHttpClient(_nodeJsFixture.NodeAppBuilder!.Resource.Name, "http"); 34using var npmClient = _nodeJsFixture.App.CreateHttpClient(_nodeJsFixture.NpmAppBuilder!.Resource.Name, "http");
Aspire.Hosting.MongoDB.Tests (3)
MongoDbFunctionalTests.cs (1)
138using var httpClient = new HttpClient { BaseAddress = new Uri(endpoint.Url) };
ReplicaSet\MongoDbReplicaSetFunctionalTests.cs (2)
133using var httpClient = new HttpClient { BaseAddress = new Uri(endpoint.Url) }; 220using var httpClient = new HttpClient { BaseAddress = new Uri(mongoExpressEndpoint.Url) };
Aspire.Hosting.OpenAI (3)
OpenAIExtensions.cs (1)
227var httpClient = sp.GetRequiredService<IHttpClientFactory>().CreateClient("OpenAIHealthCheck");
OpenAIHealthCheck.cs (1)
59var client = string.IsNullOrWhiteSpace(_httpClientName)
OpenAIModelHealthCheck.cs (1)
17internal sealed class OpenAIModelHealthCheck(HttpClient httpClient, Func<ValueTask<string?>> connectionString) : IHealthCheck
Aspire.Hosting.PostgreSQL.Tests (2)
PostgresFunctionalTests.cs (2)
90var client = app.CreateHttpClient(adminBuilder.Resource.Name, "http"); 167var client = app.CreateHttpClient(pgWebBuilder.Resource.Name, "http");
Aspire.Hosting.Redis.Tests (7)
RedisFunctionalTests.cs (7)
84var client = app.CreateHttpClient(commanderBuilder.Resource.Name, "http"); 298var client = app.CreateHttpClient(redisInsightBuilder.Resource.Name, "http"); 635var httpClient = app.CreateHttpClient(redisInsightBuilder1.Resource.Name, "http"); 670var httpClient = app.CreateHttpClient(redisInsightBuilder2.Resource.Name, "http"); 701private static async Task EnsureRedisInsightEulaAccepted(HttpClient httpClient, CancellationToken ct) 726static async Task AcceptRedisInsightEula(HttpClient client, CancellationToken ct) 795var client = clientFactory.CreateClient();
Aspire.Hosting.Seq.Tests (6)
SeqFunctionalTests.cs (6)
34var client = CreateClient(seqUrl); 42private static HttpClient CreateClient(string url) 44HttpClient client = new() 51private static async Task CreateTestDataAsync(HttpClient httpClient, CancellationToken token) 114var client = CreateClient(seqUrl); 153var client = CreateClient(seqUrl);
Aspire.Hosting.Testing (7)
DistributedApplicationFactory.cs (3)
77/// Creates an instance of <see cref="HttpClient"/> that is configured to route requests to the specified resource and endpoint. 79/// <returns>The <see cref="HttpClient"/>.</returns> 80public HttpClient CreateHttpClient(string resourceName, string? endpointName = default)
DistributedApplicationHostingTestingExtensions.cs (4)
140/// Creates an <see cref="HttpClient"/> configured to communicate with the specified resource. 146/// <returns>The <see cref="HttpClient"/>.</returns> 148public static HttpClient CreateHttpClient(this DistributedApplication app, string resourceName, string? endpointName = default) 155var client = clientFactory.CreateClient();
Aspire.Hosting.Testing.Tests (15)
DashboardUrlTests.cs (4)
43using var httpClient = new HttpClient(handler) 179using var httpClient = new HttpClient(handler) 224using var httpClient = new HttpClient(handler) 269using var httpClient = new HttpClient { Timeout = TestConstants.LongTimeoutTimeSpan };
DistributedApplicationHttpClientExtensionsForTests.cs (2)
12public static HttpClient CreateHttpClientWithResilience(this DistributedApplication app, string resourceName, string? endpointName = default, Action<HttpStandardResilienceOptions>? configure = default) 15HttpClient client;
TestingBuilderTests.cs (6)
190var httpClient = app.CreateHttpClientWithResilience("mywebapp1", null, opts => 250var httpClient = app.CreateHttpClientWithResilience("mywebapp1", null, opts => 289var httpClient = app.CreateHttpClientWithResilience("mywebapp1", null, opts => 333var httpClient = app.CreateHttpClientWithResilience("mywebapp1", null, opts => 384var httpClient = app.CreateHttpClientWithResilience("mywebapp1", null, opts => 435var httpClient = app.CreateHttpClientWithResilience("mywebapp1", "https", opts =>
TestingFactoryTests.cs (2)
54var httpClient = _app.CreateHttpClientWithResilience("mywebapp1"); 82var httpClient = _app.CreateHttpClientWithResilience("mywebapp1", "https");
TestingPublicApiTests.cs (1)
215using var client = app.CreateHttpClient("service");
Aspire.Hosting.Tests (24)
ContainerTunnelTests.cs (2)
41using var clientA = app.CreateHttpClient(yarp.Resource.Name, "http"); 84using var clientA = app.CreateHttpClient(yarp.Resource.Name, "http");
DistributedApplicationTests.cs (11)
293using var serviceAClient = app.CreateHttpClientWithResilience(notStartedResourceName, "http"); 784using var clientA = app.CreateHttpClient(testProgram.ServiceABuilder.Resource.Name, "http"); 785using var clientC = app.CreateHttpClient(testProgram.ServiceCBuilder.Resource.Name, "http"); 797using var clientB = new HttpClient(); 1271using var serviceAClient = app.CreateHttpClientWithResilience(testProgram.ServiceABuilder.Resource.Name, "http"); 1736var client = app.CreateHttpClientWithResilience($"{testName}-servicea", "http"); 1744using var client2 = new HttpClient(new SocketsHttpHandler 1791using var client = new HttpClient(); 1811using var client = new HttpClient(); 1854using var clientA = app.CreateHttpClient(servicea.Resource.Name, "http"); 1928using var clientA = app.CreateHttpClient(servicea.Resource.Name, "http");
SlimTestProgramTests.cs (3)
36using var clientA = app.CreateHttpClientWithResilience(testProgram.ServiceABuilder.Resource.Name, "http"); 39using var clientB = app.CreateHttpClientWithResilience(testProgram.ServiceBBuilder.Resource.Name, "http"); 42using var clientC = app.CreateHttpClientWithResilience(testProgram.ServiceCBuilder.Resource.Name, "http");
TestProgramFixture.cs (3)
68using var clientA = App.CreateHttpClientWithResilience(TestProgram.ServiceABuilder.Resource.Name, "http"); 72using var clientB = App.CreateHttpClientWithResilience(TestProgram.ServiceBBuilder.Resource.Name, "http"); 76using var clientC = App.CreateHttpClientWithResilience(TestProgram.ServiceCBuilder.Resource.Name, "http");
tests\Aspire.Hosting.Testing.Tests\DistributedApplicationHttpClientExtensionsForTests.cs (2)
12public static HttpClient CreateHttpClientWithResilience(this DistributedApplication app, string resourceName, string? endpointName = default, Action<HttpStandardResilienceOptions>? configure = default) 15HttpClient client;
WithUrlsTests.cs (3)
1067using var resourceAClient = app.CreateHttpClientWithResilience(resourceA.Resource.Name, "api"); 1068using var resourceBClient = app.CreateHttpClientWithResilience(resourceB.Resource.Name, "http"); 1125using var resourceAClient = app.CreateHttpClientWithResilience(resourceA.Resource.Name, "api");
Aspire.Hosting.Yarp.Tests (1)
YarpFunctionalTests.cs (1)
57using var httpClient = app.CreateHttpClient(yarp.Resource.Name);
Aspire.Playground.Tests (17)
AppHostTests.cs (2)
127using var client = CreateHttpClientWithResilience(app, resource); 149public static HttpClient CreateHttpClientWithResilience(DistributedApplication app, string resource)
BlazorWasmHostingTests.cs (4)
24using var blazorClient = AppHostTests.CreateHttpClientWithResilience(app, "blazorapp"); 39using var weatherApiClient = AppHostTests.CreateHttpClientWithResilience(app, "weatherapi"); 105using var gatewayClient = AppHostTests.CreateHttpClientWithResilience(app, "gateway"); 120using var weatherApiClient = AppHostTests.CreateHttpClientWithResilience(app, "weatherapi");
Infrastructure\DistributedApplicationExtensions.cs (10)
167/// Creates an <see cref="HttpClient"/> configured to communicate with the specified resource. 169public static HttpClient CreateHttpClient(this DistributedApplication app, string resourceName, bool useHttpClientFactory) 173/// Creates an <see cref="HttpClient"/> configured to communicate with the specified resource. 175public static HttpClient CreateHttpClient(this DistributedApplication app, string resourceName, string? endpointName, bool useHttpClientFactory) 183var httpClient = new HttpClient 192/// Creates an <see cref="HttpClient"/> configured to communicate with the specified resource with custom configuration. 194public static HttpClient CreateHttpClient(this DistributedApplication app, string resourceName, string? endpointName, Action<IHttpClientBuilder> configure) 202var httpClient = httpClientFactory.CreateClient(); 218using (var checkHttpClient = app.CreateHttpClient(project.Name)) 246using var applyMigrationsHttpClient = app.CreateHttpClient(project.Name, useHttpClientFactory: false);
ProjectSpecificTests.cs (1)
109using var apiServiceClient = AppHostTests.CreateHttpClientWithResilience(app, "apiservice");
Aspire.Seq (1)
SeqHealthCheck.cs (1)
14private readonly HttpClient _client = new(new SocketsHttpHandler { ActivityHeadersPropagator = null }) { BaseAddress = new Uri(seqUri) };
Aspire.Templates.Tests (4)
StarterTemplateRunTestsBase.cs (1)
83using var httpClient = new HttpClient();
tests\Shared\TemplatesTesting\AspireProject.cs (2)
25public static Lazy<HttpClient> Client => new(CreateHttpClient); 503private static HttpClient CreateHttpClient()
tests\Shared\TemplatesTesting\ProjectInfo.cs (1)
13public HttpClient Client { get; set; } = default!;
AzureFunctionsEndToEnd.ApiService (1)
Program.cs (1)
83app.MapGet("/", async (HttpClient client) =>
DevTunnels.ApiService (1)
Program.cs (1)
14var http = httpClientFactory.CreateClient("frontend");
dotnet-aot (2)
parent\dotnet\NugetSearch\NugetToolSearchApiRequest.cs (2)
28var httpClient = new HttpClient(); 97using var httpClient = new HttpClient();
dotnet-openapi (2)
HttpClientWrapper.cs (2)
17private readonly HttpClient _client; 19public HttpClientWrapper(HttpClient client)
dotnet-sourcelink (2)
dotnet-svcutil-lib (12)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\HttpChannelFactory.cs (10)
39private HttpClient _httpClient; 41private volatile MruCache<string, HttpClient> _httpClientCache; 229internal async Task<HttpClient> GetHttpClientAsync(EndpointAddress to, SecurityTokenProviderContainer tokenProvider, 241internal HttpClient GetHttpClient(EndpointAddress to, NetworkCredential credential, 251_httpClientCache = new MruCache<string, HttpClient>(10); 256HttpClient httpClient; 519var httpClientToDispose = _httpClient; 816internal virtual Task<HttpClient> GetHttpClientAsync(EndpointAddress to, Uri via, TimeoutHelper timeoutHelper) 821protected async Task<HttpClient> GetHttpClientAsync(EndpointAddress to, Uri via, SecurityTokenContainer clientCertificateToken, TimeoutHelper timeoutHelper) 883private HttpClient _httpClient;
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\HttpsChannelFactory.cs (2)
316internal override async Task<HttpClient> GetHttpClientAsync(EndpointAddress to, Uri via, TimeoutHelper timeoutHelper) 319HttpClient httpClient = await base.GetHttpClientAsync(to, via, clientCertificateToken, timeoutHelper);
DotnetProject.WorkerService (1)
Program.cs (1)
17var client = factory.CreateClient("apiservice");
GenerateDocumentationAndConfigFiles (1)
Program.cs (1)
33private static readonly HttpClient httpClient = new();
Infrastructure.Common (3)
ServiceUtilHelper.cs (3)
579using (HttpClient httpClient = new HttpClient()) 598using (HttpClient httpClient = new HttpClient()) 617using (HttpClient httpClient = new HttpClient())
installer.tasks (2)
StaticFileRegeneration\RegenerateThirdPartyNotices.cs (2)
41using (var client = new HttpClient()) 49public async Task ExecuteAsync(HttpClient client)
Keycloak.Web (1)
WeatherApiClient.cs (1)
3public class WeatherApiClient(HttpClient httpClient)
Microsoft.AspNetCore.Authentication (1)
RemoteAuthenticationOptions.cs (1)
77public HttpClient Backchannel { get; set; } = default!;
Microsoft.AspNetCore.Authentication.JwtBearer (1)
JwtBearerOptions.cs (1)
89public HttpClient Backchannel { get; set; } = default!;
Microsoft.AspNetCore.Authentication.OAuth (4)
Events\OAuthCreatingTicketContext.cs (2)
34HttpClient backchannel, 95public HttpClient Backchannel { get; }
OAuthHandler.cs (2)
26/// Gets the <see cref="HttpClient"/> instance used to communicate with the remote authentication provider. 28protected HttpClient Backchannel => Options.Backchannel;
Microsoft.AspNetCore.Authentication.OpenIdConnect (3)
Events\AuthorizationCodeReceivedContext.cs (1)
44public HttpClient Backchannel { get; internal set; } = default!;
OpenIdConnectHandler.cs (2)
39/// Gets the <see cref="HttpClient"/> used to communicate with the remote identity provider. 41protected HttpClient Backchannel => Options.Backchannel;
Microsoft.AspNetCore.Authentication.Twitter (1)
TwitterHandler.cs (1)
25private HttpClient Backchannel => Options.Backchannel;
Microsoft.AspNetCore.Components.Testing (3)
Infrastructure\ReadinessNotificationService.cs (1)
51using var client = new HttpClient();
Infrastructure\RemoteLock.cs (2)
13/// Uses <see cref="HttpClient"/> directly (not page JavaScript execution) because 41using var client = new HttpClient();
Microsoft.AspNetCore.Components.WebAssembly.Server (1)
TargetPickerUi.cs (1)
449using var httpClient = new HttpClient { Timeout = TimeSpan.FromSeconds(5) };
Microsoft.AspNetCore.Diagnostics.Middleware.Tests (4)
Logging\AcceptanceTests.cs (3)
143private static Task RunAsync(LogLevel level, Action<IServiceCollection> configure, Func<FakeLogCollector, HttpClient, Task> func) 149Func<FakeLogCollector, HttpClient, IServiceProvider, Task> func) 173using var client = host.GetTestClient();
Logging\AcceptanceTests.Mvc.cs (1)
51private static Task RunControllerAsync(LogLevel level, Action<IServiceCollection> configure, Func<FakeLogCollector, HttpClient, Task> func)
Microsoft.AspNetCore.HeaderPropagation (7)
DependencyInjection\HeaderPropagationApplicationBuilderExtensions.cs (2)
12/// <see cref="IApplicationBuilder"/> extension methods for <see cref="HeaderPropagationMiddleware"/> which propagates request headers to an <see cref="HttpClient"/>. 23/// Adds a middleware that collect headers to be propagated to a <see cref="HttpClient"/>.
DependencyInjection\HeaderPropagationHttpClientBuilderExtensions.cs (1)
10/// <see cref="IHttpClientBuilder"/> extension methods for <see cref="HeaderPropagationMiddleware"/> which propagates request headers to an <see cref="System.Net.Http.HttpClient"/>.
DependencyInjection\HeaderPropagationServiceCollectionExtensions.cs (3)
11/// <see cref="IServiceCollection"/> extension methods for <see cref="HeaderPropagationMiddleware"/> which propagates request headers to an <see cref="System.Net.Http.HttpClient"/>. 16/// Adds services required for propagating headers to a <see cref="HttpClient"/>. 30/// Adds services required for propagating headers to a <see cref="HttpClient"/>.
HeaderPropagationMiddleware.cs (1)
12/// A Middleware for propagating headers to an <see cref="HttpClient"/>.
Microsoft.AspNetCore.Http.Connections.Client (13)
HttpConnection.cs (4)
46private readonly HttpClient _httpClient; 453private async Task<NegotiationResponse> NegotiateAsync(Uri url, HttpClient httpClient, ILogger logger, CancellationToken cancellationToken) 573private HttpClient CreateHttpClient() 654var httpClient = new HttpClient(httpMessageHandler);
Internal\DefaultTransportFactory.cs (2)
13private readonly HttpClient? _httpClient; 20public DefaultTransportFactory(HttpTransportType requestedTransportType, ILoggerFactory loggerFactory, HttpClient? httpClient, HttpConnectionOptions httpConnectionOptions, Func<Task<string?>> accessTokenProvider)
Internal\LongPollingTransport.cs (2)
20private readonly HttpClient _httpClient; 36public LongPollingTransport(HttpClient httpClient, HttpConnectionOptions? httpConnectionOptions = null, ILoggerFactory? loggerFactory = null)
Internal\SendUtils.cs (1)
19public static async Task SendMessages(Uri sendUrl, IDuplexPipe application, HttpClient httpClient, ILogger logger, CancellationToken cancellationToken = default)
Internal\ServerSentEventsTransport.cs (2)
21private readonly HttpClient _httpClient; 37public ServerSentEventsTransport(HttpClient httpClient, HttpConnectionOptions? httpConnectionOptions = null, ILoggerFactory? loggerFactory = null)
Internal\WebSocketsTransport.cs (2)
39private readonly HttpClient? _httpClient; 74public WebSocketsTransport(HttpConnectionOptions httpConnectionOptions, ILoggerFactory loggerFactory, Func<Task<string?>> accessTokenProvider, HttpClient? httpClient,
Microsoft.AspNetCore.Mvc.Testing (33)
WebApplicationFactory.cs (28)
44private readonly List<HttpClient> _clients = new(); 51/// and one or more <see cref="HttpClient"/> instances used to send <see cref="HttpRequestMessage"/> to the <see cref="TestServer"/>. 687/// Creates an instance of <see cref="HttpClient"/> that automatically follows 690/// <returns>The <see cref="HttpClient"/>.</returns> 691public HttpClient CreateClient() 693var client = CreateClient(ClientOptions); 708/// Creates an instance of <see cref="HttpClient"/> that automatically follows 711/// <returns>The <see cref="HttpClient"/>.</returns> 712public HttpClient CreateClient(WebApplicationFactoryClientOptions options) => 716/// Creates a new instance of an <see cref="HttpClient"/> that can be used to 717/// send <see cref="HttpRequestMessage"/> to the server. The base address of the <see cref="HttpClient"/> 721/// <see cref="HttpClient"/>.</param> 722/// <returns>The <see cref="HttpClient"/>.</returns> 723public HttpClient CreateDefaultClient(params DelegatingHandler[] handlers) 727HttpClient client; 780/// Configures <see cref="HttpClient"/> instances created by this <see cref="WebApplicationFactory{TEntryPoint}"/>. 782/// <param name="client">The <see cref="HttpClient"/> instance getting configured.</param> 783protected virtual void ConfigureClient(HttpClient client) 803/// Creates a new instance of an <see cref="HttpClient"/> that can be used to 806/// <param name="baseAddress">The base address of the <see cref="HttpClient"/> instance.</param> 808/// <see cref="HttpClient"/>.</param> 809/// <returns>The <see cref="HttpClient"/>.</returns> 810public HttpClient CreateDefaultClient(Uri baseAddress, params DelegatingHandler[] handlers) 812var client = CreateDefaultClient(handlers); 867foreach (var client in _clients) 900private readonly Action<HttpClient> _configureClient; 910Action<HttpClient> configureClient, 939protected override void ConfigureClient(HttpClient client) => _configureClient(client);
WebApplicationFactoryClientOptions.cs (5)
12/// <see cref="HttpClient"/> instances by calling 36/// Gets or sets the base address of <see cref="HttpClient"/> instances created by calling 43/// Gets or sets whether or not <see cref="HttpClient"/> instances created by calling 51/// Gets or sets the maximum number of redirect responses that <see cref="HttpClient"/> instances 59/// Gets or sets whether <see cref="HttpClient"/> instances created by calling
Microsoft.AspNetCore.Server.IntegrationTesting (6)
Common\DeploymentResult.cs (4)
38/// An <see cref="HttpClient"/> with <see cref="LoggingHandler"/> configured and the <see cref="HttpClient.BaseAddress"/> set to the <see cref="ApplicationBaseUri"/> 40public HttpClient HttpClient { get; } 59/// Create an <see cref="HttpClient"/> with <see cref="LoggingHandler"/> configured and the <see cref="HttpClient.BaseAddress"/> set to the <see cref="ApplicationBaseUri"/>, 64public HttpClient CreateHttpClient(HttpMessageHandler baseHandler) =>
Common\LoggingHandler.cs (1)
15_logger = loggerFactory.CreateLogger<HttpClient>();
Deployers\NginxDeployer.cs (1)
78using (var httpClient = new HttpClient())
Microsoft.AspNetCore.SpaProxy (5)
SpaProxyLaunchManager.cs (5)
75var httpClient = CreateHttpClient(); 94private static HttpClient CreateHttpClient() 96var httpClient = new HttpClient(new HttpClientHandler() 106private async Task<bool> ProbeSpaDevelopmentServerUrl(HttpClient httpClient, CancellationToken cancellationToken) 131var httpClient = CreateHttpClient();
Microsoft.AspNetCore.SpaServices.Extensions (5)
AngularCli\AngularCliMiddleware.cs (1)
105using (var client = new HttpClient())
Proxying\ConditionalProxyMiddleware.cs (1)
20private readonly HttpClient _httpClient;
Proxying\SpaProxy.cs (2)
40public static HttpClient CreateHttpClientForProxy(TimeSpan requestTimeout) 56HttpClient httpClient,
Proxying\SpaProxyingExtensions.cs (1)
70var neverTimeOutHttpClient =
Microsoft.AspNetCore.TestHost (4)
HostBuilderTestServerExtensions.cs (1)
31public static HttpClient GetTestClient(this IHost host)
TestServer.cs (2)
179/// Creates a <see cref="HttpClient" /> for processing HTTP requests/responses with the test server. 181public HttpClient CreateClient()
WebHostBuilderExtensions.cs (1)
69public static HttpClient GetTestClient(this IWebHost host)
Microsoft.AspNetCore.Testing (3)
ServiceFakesHostExtensions.cs (3)
27/// Creates an <see cref="HttpClient"/> to call the hosted application. 32/// <returns>An <see cref="HttpClient"/> configured to call the hosted application.</returns> 35public static HttpClient CreateClient(this IHost host, HttpMessageHandler? handler = null, Func<Uri, bool>? addressFilter = null)
Microsoft.AspNetCore.Testing.Tests (7)
FakesExtensionsTests.cs (7)
60var client = new HttpClient(new FakeCertificateHttpClientHandler(certificate)) 77var client = host.CreateClient(new FakeCertificateHttpClientHandler(certificate)); 88using var client = hostMock.Object.CreateClient(handler); 99using var client = hostMock.Object.CreateClient(); 152using var client = hostMock.Object.CreateClient(null, x => x.AbsoluteUri == _urlAddresses[1]); 164using var client = host.CreateClient(); 176using var client = host.CreateClient();
Microsoft.AspNetCore.Watch.BrowserRefresh (1)
src\sdk\src\Dotnet.Watch\Web.Middleware\BrowserToolsForwarder.cs (1)
37private readonly HttpClient _httpClient;
Microsoft.Build.Tasks.Core (1)
DownloadFile.cs (1)
154using (var client = new HttpClient(HttpMessageHandler ?? new HttpClientHandler(), disposeHandler: true) { Timeout = TimeSpan.FromMilliseconds(Timeout) })
Microsoft.Deployment.DotNet.Releases (1)
Utils.cs (1)
20internal static readonly HttpClient s_httpClient;
Microsoft.DotNet.Arcade.Sdk (2)
src\DownloadFile.cs (2)
171using (var httpClient = new HttpClient(handler)) 191private async Tasks.Task<bool> DownloadWithRetriesAsync(HttpClient httpClient, string uri, AbsolutePath destinationPath)
Microsoft.DotNet.Cli.Telemetry (4)
Implementation\HttpTelemetryUploadTransport.cs (4)
11/// plain <see cref="HttpClient"/>. The request body is the newline-delimited JSON produced by 21private static readonly HttpClient s_httpClient = new() { Timeout = System.Threading.Timeout.InfiniteTimeSpan }; 24private readonly HttpClient _client; 38private HttpTelemetryUploadTransport(Uri trackUri, HttpClient client)
Microsoft.Extensions.AI.Evaluation.Safety (6)
ContentSafetyService.cs (2)
23private static HttpClient SharedHttpClient => 31private readonly HttpClient _httpClient = serviceConfiguration.HttpClient ?? SharedHttpClient;
ContentSafetyServiceConfiguration.cs (4)
69public HttpClient? HttpClient { get; } 126HttpClient? httpClient = null, 168HttpClient? httpClient = null, 208HttpClient? httpClient = null,
Microsoft.Extensions.AI.OpenAI.Tests (201)
OpenAIChatClientTests.cs (24)
152using HttpClient httpClient = new(handler); 231using HttpClient httpClient = new(handler); 329using HttpClient httpClient = new(handler); 382using HttpClient httpClient = new(handler); 459using HttpClient httpClient = new(handler); 542using HttpClient httpClient = new(handler); 616using HttpClient httpClient = new(handler); 725using HttpClient httpClient = new(handler); 816using HttpClient httpClient = new(handler); 923using HttpClient httpClient = new(handler); 1019using HttpClient httpClient = new(handler); 1138using HttpClient httpClient = new(handler); 1223using HttpClient httpClient = new(handler); 1322using HttpClient httpClient = new(handler); 1462using HttpClient httpClient = new(handler); 1587using HttpClient httpClient = new(handler); 1634using HttpClient httpClient = new(handler); 1682using HttpClient httpClient = new(handler); 1728using HttpClient httpClient = new(handler); 1746private static IChatClient CreateChatClient(HttpClient httpClient, string modelId) => 1867using HttpClient httpClient = new(handler); 1912using HttpClient httpClient = new(handler); 1962using HttpClient httpClient = new(handler); 2030using HttpClient httpClient = new(handler);
OpenAIEmbeddingGeneratorTests.cs (6)
127using HttpClient httpClient = new(handler); 187using HttpClient httpClient = new(handler); 245using HttpClient httpClient = new(handler); 288using HttpClient httpClient = new(handler); 308using HttpClient httpClient = new(handler); 317private static IEmbeddingGenerator<string, Embedding<float>> CreateEmbeddingGenerator(HttpClient httpClient, string modelId) =>
OpenAIHostedFileClientTests.cs (41)
108using HttpClient httpClient = new(handler); 145using HttpClient httpClient = new(handler); 159using HttpClient httpClient = new(); 168using HttpClient httpClient = new(); 177using HttpClient httpClient = new(); 198using HttpClient httpClient = new(handler); 217using HttpClient httpClient = new(handler); 228using HttpClient httpClient = new(); 237using HttpClient httpClient = new(); 257using HttpClient httpClient = new(handler); 294using HttpClient httpClient = new(handler); 315using HttpClient httpClient = new(handler); 337using HttpClient httpClient = new(handler); 349using HttpClient httpClient = new(handler); 360using HttpClient httpClient = new(); 369using HttpClient httpClient = new(); 378using HttpClient httpClient = new(); 389using HttpClient httpClient = new(); 399using HttpClient httpClient = new(); 409using HttpClient httpClient = new(); 419using HttpClient httpClient = new(); 429using HttpClient httpClient = new(); 440using HttpClient httpClient = new(); 450using HttpClient httpClient = new(); 460using HttpClient httpClient = new(); 470using HttpClient httpClient = new(); 587using HttpClient httpClient = new(handler); 621using HttpClient httpClient = new(handler); 658using HttpClient httpClient = new(handler); 683using HttpClient httpClient = new(handler); 713using HttpClient httpClient = new(handler); 740using HttpClient httpClient = new(handler); 755using HttpClient httpClient = new(handler); 782using HttpClient httpClient = new(handler); 806using HttpClient httpClient = new(handler); 818using HttpClient httpClient = new(handler); 843using HttpClient httpClient = new(handler); 867using HttpClient httpClient = new(handler); 886private static IHostedFileClient CreateFileClient(HttpClient httpClient) => 890private static IHostedFileClient CreateFileOnlyClient(HttpClient httpClient) => 895private static IHostedFileClient CreateContainerClient(HttpClient httpClient, string? defaultScope = null) =>
OpenAIRequestPoliciesTests.cs (4)
89using var http = new HttpClient(handler); 105using var http = new HttpClient(handler); 121using var http = new HttpClient(handler); 148private static IChatClient NewChatClient(HttpClient? http = null)
OpenAIResponseClientTests.cs (103)
150using HttpClient httpClient = new(handler); 293using HttpClient httpClient = new(handler); 423using HttpClient httpClient = new(handler); 553using HttpClient httpClient = new(handler); 655using HttpClient httpClient = new(handler); 729using HttpClient httpClient = new(handler); 849using HttpClient httpClient = new(handler); 989using HttpClient httpClient = new(handler); 1084using HttpClient httpClient = new(handler); 1191using HttpClient httpClient = new(handler); 1336using HttpClient httpClient = new(handler); 1464using HttpClient httpClient = new(handler); 1598using (HttpClient httpClient = new(handler)) 1719using (HttpClient httpClient = new(handler)) 1858using HttpClient httpClient = new(handler); 2086using HttpClient httpClient = new(handler); 2499using HttpClient httpClient = new(handler); 2706using HttpClient httpClient = new(handler); 2817using HttpClient httpClient = new(handler); 2907using HttpClient httpClient = new(handler); 2979using HttpClient httpClient = new(handler); 3068using HttpClient httpClient = new(handler); 3120using HttpClient httpClient = new(handler); 3215using HttpClient httpClient = new(handler); 3296using HttpClient httpClient = new(handler); 3363using HttpClient httpClient = new(handler); 3487using HttpClient httpClient = new(handler); 3707using HttpClient httpClient = new(handler); 3794using HttpClient httpClient = new(handler); 3863using HttpClient httpClient = new(handler); 3915using HttpClient httpClient = new(handler); 3973using HttpClient httpClient = new(handler); 4032using HttpClient httpClient = new(handler); 4093using HttpClient httpClient = new(handler); 4155using HttpClient httpClient = new(handler); 4218using HttpClient httpClient = new(handler); 4291using HttpClient httpClient = new(handler); 4372using HttpClient httpClient = new(handler); 4443using HttpClient httpClient = new(handler); 4513using HttpClient httpClient = new(handler); 4590using HttpClient httpClient = new(handler); 4668using HttpClient httpClient = new(handler); 4734using HttpClient httpClient = new(handler); 4795using HttpClient httpClient = new(handler); 4865using HttpClient httpClient = new(handler); 4924using HttpClient httpClient = new(handler); 4980using HttpClient httpClient = new(handler); 5041using HttpClient httpClient = new(handler); 5099using HttpClient httpClient = new(handler); 5156using HttpClient httpClient = new(handler); 5215using HttpClient httpClient = new(handler); 5277using HttpClient httpClient = new(handler); 5333using HttpClient httpClient = new(handler); 5388using HttpClient httpClient = new(handler); 5445using HttpClient httpClient = new(handler); 5502using HttpClient httpClient = new(handler); 5539using HttpClient httpClient = new(handler); 5571using HttpClient httpClient = new(handler); 5615using HttpClient httpClient = new(handler); 5668using HttpClient httpClient = new(handler); 5723using HttpClient httpClient = new(handler); 5761using HttpClient httpClient = new(handler); 5796using HttpClient httpClient = new(handler); 5831using HttpClient httpClient = new(handler); 5866using HttpClient httpClient = new(handler); 5904using HttpClient httpClient = new(handler); 5942using HttpClient httpClient = new(handler); 5962using HttpClient httpClient = new(); 6000using HttpClient httpClient = new(handler); 6043using HttpClient httpClient = new(handler); 6086using HttpClient httpClient = new(handler); 6129using HttpClient httpClient = new(handler); 6204using HttpClient httpClient = new(handler); 6276using HttpClient httpClient = new(handler); 6317using HttpClient httpClient = new(handler); 6371using HttpClient httpClient = new(handler); 6434using HttpClient httpClient = new(handler); 6507using HttpClient httpClient = new(handler); 6607using HttpClient httpClient = new(handler); 6724using HttpClient httpClient = new(handler); 6854using HttpClient httpClient = new(handler); 6918using HttpClient httpClient = new(handler); 6993using HttpClient httpClient = new(handler); 7015private static IChatClient CreateResponseClient(HttpClient httpClient, string modelId) => 7275using HttpClient httpClient = new(handler); 7402using HttpClient httpClient = new(handler); 7512using HttpClient httpClient = new(handler); 7596using HttpClient httpClient = new(handler); 7688using HttpClient httpClient = new(handler); 7758using HttpClient httpClient = new(handler); 7864using HttpClient httpClient = new(handler); 7965using HttpClient httpClient = new(handler); 8070using HttpClient httpClient = new(handler); 8170using HttpClient httpClient = new(handler); 8257using HttpClient httpClient = new(handler); 8348using HttpClient httpClient = new(handler); 8433using HttpClient httpClient = new(handler); 8546using HttpClient httpClient = new(handler); 8645using HttpClient httpClient = new(handler); 8750using HttpClient httpClient = new(handler); 8863using HttpClient httpClient = new(handler); 8968using HttpClient httpClient = new(handler); 9061using HttpClient httpClient = new(handler);
OpenAISpeechToTextClientTests.cs (13)
86using HttpClient httpClient = new(handler); 107using HttpClient httpClient = new(); 121using HttpClient httpClient = new(); 161using HttpClient httpClient = new(handler); 196using HttpClient httpClient = new(handler); 233using HttpClient httpClient = new(handler); 270using HttpClient httpClient = new(handler); 312using HttpClient httpClient = new(handler); 351private static ISpeechToTextClient CreateSpeechToTextClient(HttpClient httpClient, string modelId) => 399using HttpClient httpClient = new(handler); 430using HttpClient httpClient = new(handler); 463using HttpClient httpClient = new(handler); 496using HttpClient httpClient = new(handler);
OpenAITextToSpeechClientTests.cs (10)
78using HttpClient httpClient = new(handler); 106using HttpClient httpClient = new(handler); 135using HttpClient httpClient = new(handler); 168using HttpClient httpClient = new(handler); 198using HttpClient httpClient = new(handler); 221using HttpClient httpClient = new(); 234using HttpClient httpClient = new(); 262using HttpClient httpClient = new(handler); 307using HttpClient httpClient = new(handler); 343private static ITextToSpeechClient CreateTextToSpeechClient(HttpClient httpClient, string modelId) =>
Microsoft.Extensions.DataIngestion.Tests (1)
Readers\DocumentReaderConformanceTests.cs (1)
17private static readonly HttpClient _httpClient = new() { Timeout = TimeSpan.FromSeconds(30) };
Microsoft.Extensions.Http (174)
DefaultHttpClientFactory.cs (2)
103public HttpClient CreateClient(string name) 108var client = new HttpClient(handler, disposeHandler: false);
DefaultTypedHttpClientFactory.cs (2)
26public TClient CreateClient(HttpClient httpClient) 42return ActivatorUtilities.CreateFactory(typeof(TClient), new Type[] { typeof(HttpClient), });
DependencyInjection\HttpClientBuilderExtensions.cs (43)
23/// Adds a delegate that will be used to configure a named <see cref="HttpClient"/>. 26/// <param name="configureClient">A delegate that is used to configure an <see cref="HttpClient"/>.</param> 28public static IHttpClientBuilder ConfigureHttpClient(this IHttpClientBuilder builder, Action<HttpClient> configureClient) 39/// Adds a delegate that will be used to configure a named <see cref="HttpClient"/>. 42/// <param name="configureClient">A delegate that is used to configure an <see cref="HttpClient"/>.</param> 48public static IHttpClientBuilder ConfigureHttpClient(this IHttpClientBuilder builder, Action<IServiceProvider, HttpClient> configureClient) 65/// Adds a delegate that will be used to create an additional message handler for a named <see cref="HttpClient"/>. 88/// Adds a delegate that will be used to create an additional message handler for a named <see cref="HttpClient"/>. 117/// Adds an additional message handler from the dependency injection container for a named <see cref="HttpClient"/>. 145/// named <see cref="HttpClient"/>. 169/// named <see cref="HttpClient"/>. 199/// for a named <see cref="HttpClient"/>. 227/// named <see cref="HttpClient"/>. 253/// for a named <see cref="HttpClient"/>. 271/// Adds or updates <see cref="SocketsHttpHandler"/> as a primary handler for a named <see cref="HttpClient"/>. If provided, 307/// Adds or updates <see cref="SocketsHttpHandler"/> as a primary handler for a named <see cref="HttpClient"/> 336/// Configures a binding between the <typeparamref name="TClient" /> type and the named <see cref="HttpClient"/> 346/// <typeparamref name="TClient"/> instances constructed with the appropriate <see cref="HttpClient" /> 385HttpClient httpClient = httpClientFactory.CreateClient(builder.Name); 392/// Configures a binding between the <typeparamref name="TClient" /> type and the named <see cref="HttpClient"/> 407/// <typeparamref name="TClient"/> instances constructed with the appropriate <see cref="HttpClient" /> 449HttpClient httpClient = httpClientFactory.CreateClient(builder.Name); 456/// Configures a binding between the <typeparamref name="TClient" /> type and the named <see cref="HttpClient"/> 467/// <typeparamref name="TClient"/> instances constructed with the appropriate <see cref="HttpClient" /> 472/// Calling <see cref="HttpClientBuilderExtensions.AddTypedClient{TClient}(IHttpClientBuilder,Func{HttpClient,TClient})"/> 476public static IHttpClientBuilder AddTypedClient<TClient>(this IHttpClientBuilder builder, Func<HttpClient, TClient> factory) 485internal static IHttpClientBuilder AddTypedClientCore<TClient>(this IHttpClientBuilder builder, Func<HttpClient, TClient> factory, bool validateSingleType) 493HttpClient httpClient = httpClientFactory.CreateClient(builder.Name); 502/// Configures a binding between the <typeparamref name="TClient" /> type and the named <see cref="HttpClient"/> 513/// <typeparamref name="TClient"/> instances constructed with the appropriate <see cref="HttpClient" /> 518/// Calling <see cref="HttpClientBuilderExtensions.AddTypedClient{TClient}(IHttpClientBuilder,Func{HttpClient,IServiceProvider,TClient})"/> 522public static IHttpClientBuilder AddTypedClient<TClient>(this IHttpClientBuilder builder, Func<HttpClient, IServiceProvider, TClient> factory) 531internal static IHttpClientBuilder AddTypedClientCore<TClient>(this IHttpClientBuilder builder, Func<HttpClient, IServiceProvider, TClient> factory, bool validateSingleType) 542HttpClient httpClient = httpClientFactory.CreateClient(builder.Name); 612/// <see cref="HttpClient"/> instances will prevent the underlying <see cref="HttpMessageHandler"/> from being 631/// for a named <see cref="HttpClient"/>. 650/// Registers a named <see cref="HttpClient"/> and the related handler pipeline <see cref="HttpMessageHandler"/> as keyed 664/// WARNING: Registering the client as a keyed <see cref="ServiceLifetime.Transient"/> service will lead to the <see cref="HttpClient"/> and <see cref="HttpMessageHandler"/> 669/// WARNING: In case of (1) a keyed <see cref="ServiceLifetime.Singleton"/> <see cref="HttpClient"/> registration, or (2) a keyed <see cref="ServiceLifetime.Transient"/> 670/// <see cref="HttpClient"/> injected into a <see cref="ServiceLifetime.Singleton"/> service, or (3) long-running application scopes, 671/// the <see cref="HttpClient"/> instances will get captured by a singleton or a long-running scope, so they will NOT be able to participate in the handler rotation, 683/// the key <see cref="KeyedService.AnyKey"/> is used, so any named <see cref="HttpClient"/> instance will be resolvable as a keyed service (unless explicitly opted-out 718/// Removes the keyed registrations for the named <see cref="HttpClient"/> and <see cref="HttpMessageHandler"/>.
DependencyInjection\HttpClientBuilderExtensions.Logging.cs (6)
13/// Adds a delegate that will be used to create an additional logger for a named <see cref="System.Net.Http.HttpClient"/>. The custom logger would be invoked 14/// from a dedicated logging DelegatingHandler on every request of the corresponding named <see cref="System.Net.Http.HttpClient"/>. 73/// Adds a delegate that will be used to create an additional logger for a named <see cref="System.Net.Http.HttpClient"/>. The custom logger would be invoked 74/// from a dedicated logging DelegatingHandler on every request of the corresponding named <see cref="System.Net.Http.HttpClient"/>. 117/// Removes all previously added loggers for a named <see cref="System.Net.Http.HttpClient"/>, including default ones. 135/// Adds back the default logging for a named <see cref="System.Net.Http.HttpClient"/>, if it was removed previously by calling <see cref="RemoveAllLoggers"/>.
DependencyInjection\HttpClientFactoryServiceCollectionExtensions.cs (90)
75/// Adds a delegate that will be used to configure all <see cref="HttpClient"/> instances. 94/// a named <see cref="HttpClient"/>. 97/// <param name="name">The logical name of the <see cref="HttpClient"/> to configure.</param> 101/// <see cref="HttpClient"/> instances that apply the provided configuration can be retrieved using 120/// a named <see cref="HttpClient"/>. 123/// <param name="name">The logical name of the <see cref="HttpClient"/> to configure.</param> 124/// <param name="configureClient">A delegate that is used to configure an <see cref="HttpClient"/>.</param> 128/// <see cref="HttpClient"/> instances that apply the provided configuration can be retrieved using 135public static IHttpClientBuilder AddHttpClient(this IServiceCollection services, string name, Action<HttpClient> configureClient) 150/// a named <see cref="HttpClient"/>. 153/// <param name="name">The logical name of the <see cref="HttpClient"/> to configure.</param> 154/// <param name="configureClient">A delegate that is used to configure an <see cref="HttpClient"/>.</param> 158/// <see cref="HttpClient"/> instances that apply the provided configuration can be retrieved using 165public static IHttpClientBuilder AddHttpClient(this IServiceCollection services, string name, Action<IServiceProvider, HttpClient> configureClient) 180/// a binding between the <typeparamref name="TClient"/> type and a named <see cref="HttpClient"/>. The client name 191/// <see cref="HttpClient"/> instances that apply the provided configuration can be retrieved using 195/// <typeparamref name="TClient"/> instances constructed with the appropriate <see cref="HttpClient" /> 216/// a binding between the <typeparamref name="TClient" /> type and a named <see cref="HttpClient"/>. The client name will 231/// <see cref="HttpClient"/> instances that apply the provided configuration can be retrieved using 235/// <typeparamref name="TClient"/> instances constructed with the appropriate <see cref="HttpClient" /> 257/// a binding between the <typeparamref name="TClient"/> type and a named <see cref="HttpClient"/>. 264/// <param name="name">The logical name of the <see cref="HttpClient"/> to configure.</param> 268/// <see cref="HttpClient"/> instances that apply the provided configuration can be retrieved using 272/// <typeparamref name="TClient"/> instances constructed with the appropriate <see cref="HttpClient" /> 296/// a binding between the <typeparamref name="TClient" /> type and a named <see cref="HttpClient"/>. 307/// <param name="name">The logical name of the <see cref="HttpClient"/> to configure.</param> 311/// <see cref="HttpClient"/> instances that apply the provided configuration can be retrieved using 315/// <typeparamref name="TClient"/> instances constructed with the appropriate <see cref="HttpClient" /> 340/// a binding between the <typeparamref name="TClient" /> type and a named <see cref="HttpClient"/>. The client name will 348/// <param name="configureClient">A delegate that is used to configure an <see cref="HttpClient"/>.</param> 352/// <see cref="HttpClient"/> instances that apply the provided configuration can be retrieved using 356/// <typeparamref name="TClient"/> instances constructed with the appropriate <see cref="HttpClient" /> 362this IServiceCollection services, Action<HttpClient> configureClient) 379/// a binding between the <typeparamref name="TClient" /> type and a named <see cref="HttpClient"/>. The client name will 387/// <param name="configureClient">A delegate that is used to configure an <see cref="HttpClient"/>.</param> 391/// <see cref="HttpClient"/> instances that apply the provided configuration can be retrieved using 395/// <typeparamref name="TClient"/> instances constructed with the appropriate <see cref="HttpClient" /> 401this IServiceCollection services, Action<IServiceProvider, HttpClient> configureClient) 418/// a binding between the <typeparamref name="TClient" /> type and a named <see cref="HttpClient"/>. The client name will 430/// <param name="configureClient">A delegate that is used to configure an <see cref="HttpClient"/>.</param> 434/// <see cref="HttpClient"/> instances that apply the provided configuration can be retrieved using 438/// <typeparamref name="TClient"/> instances constructed with the appropriate <see cref="HttpClient" /> 444this IServiceCollection services, Action<HttpClient> configureClient) 462/// a binding between the <typeparamref name="TClient" /> type and a named <see cref="HttpClient"/>. The client name will 474/// <param name="configureClient">A delegate that is used to configure an <see cref="HttpClient"/>.</param> 478/// <see cref="HttpClient"/> instances that apply the provided configuration can be retrieved using 482/// <typeparamref name="TClient"/> instances constructed with the appropriate <see cref="HttpClient" /> 488this IServiceCollection services, Action<IServiceProvider, HttpClient> configureClient) 506/// a binding between the <typeparamref name="TClient" /> type and a named <see cref="HttpClient"/>. 513/// <param name="name">The logical name of the <see cref="HttpClient"/> to configure.</param> 514/// <param name="configureClient">A delegate that is used to configure an <see cref="HttpClient"/>.</param> 518/// <see cref="HttpClient"/> instances that apply the provided configuration can be retrieved using 522/// <typeparamref name="TClient"/> instances constructed with the appropriate <see cref="HttpClient" /> 531this IServiceCollection services, string name, Action<HttpClient> configureClient) 548/// a binding between the <typeparamref name="TClient" /> type and a named <see cref="HttpClient"/>. 555/// <param name="name">The logical name of the <see cref="HttpClient"/> to configure.</param> 556/// <param name="configureClient">A delegate that is used to configure an <see cref="HttpClient"/>.</param> 560/// <see cref="HttpClient"/> instances that apply the provided configuration can be retrieved using 564/// <typeparamref name="TClient"/> instances constructed with the appropriate <see cref="HttpClient" /> 573this IServiceCollection services, string name, Action<IServiceProvider, HttpClient> configureClient) 590/// a binding between the <typeparamref name="TClient" /> type and a named <see cref="HttpClient"/>. 601/// <param name="name">The logical name of the <see cref="HttpClient"/> to configure.</param> 602/// <param name="configureClient">A delegate that is used to configure an <see cref="HttpClient"/>.</param> 606/// <see cref="HttpClient"/> instances that apply the provided configuration can be retrieved using 610/// <typeparamref name="TClient"/> instances constructed with the appropriate <see cref="HttpClient" /> 619this IServiceCollection services, string name, Action<HttpClient> configureClient) 637/// a binding between the <typeparamref name="TClient" /> type and a named <see cref="HttpClient"/>. 648/// <param name="name">The logical name of the <see cref="HttpClient"/> to configure.</param> 649/// <param name="configureClient">A delegate that is used to configure an <see cref="HttpClient"/>.</param> 653/// <see cref="HttpClient"/> instances that apply the provided configuration can be retrieved using 657/// <typeparamref name="TClient"/> instances constructed with the appropriate <see cref="HttpClient" /> 666this IServiceCollection services, string name, Action<IServiceProvider, HttpClient> configureClient) 684/// a binding between the <typeparamref name="TClient" /> type and a named <see cref="HttpClient"/>. 698/// <see cref="HttpClient"/> instances that apply the provided configuration can be retrieved using 702/// <typeparamref name="TClient"/> instances constructed with the appropriate <see cref="HttpClient" /> 707public static IHttpClientBuilder AddHttpClient<TClient, TImplementation>(this IServiceCollection services, Func<HttpClient, TImplementation> factory) 720/// a binding between the <typeparamref name="TClient" /> type and a named <see cref="HttpClient"/>. 730/// <param name="name">The logical name of the <see cref="HttpClient"/> to configure.</param> 735/// <see cref="HttpClient"/> instances that apply the provided configuration can be retrieved using 739/// <typeparamref name="TClient"/> instances constructed with the appropriate <see cref="HttpClient" /> 746public static IHttpClientBuilder AddHttpClient<TClient, TImplementation>(this IServiceCollection services, string name, Func<HttpClient, TImplementation> factory) 763/// a binding between the <typeparamref name="TClient" /> type and a named <see cref="HttpClient"/>. 777/// <see cref="HttpClient"/> instances that apply the provided configuration can be retrieved using 781/// <typeparamref name="TClient"/> instances constructed with the appropriate <see cref="HttpClient" /> 786public static IHttpClientBuilder AddHttpClient<TClient, TImplementation>(this IServiceCollection services, Func<HttpClient, IServiceProvider, TImplementation> factory) 799/// a binding between the <typeparamref name="TClient" /> type and a named <see cref="HttpClient"/>. 809/// <param name="name">The logical name of the <see cref="HttpClient"/> to configure.</param> 814/// <see cref="HttpClient"/> instances that apply the provided configuration can be retrieved using 818/// <typeparamref name="TClient"/> instances constructed with the appropriate <see cref="HttpClient" /> 823public static IHttpClientBuilder AddHttpClient<TClient, TImplementation>(this IServiceCollection services, string name, Func<HttpClient, IServiceProvider, TImplementation> factory)
DependencyInjection\HttpClientKeyedLifetime.cs (2)
31Client = ServiceDescriptor.DescribeKeyed(typeof(HttpClient), ServiceKey, CreateKeyedClient, lifetime); 60private static HttpClient CreateKeyedClient(IServiceProvider serviceProvider, object? key)
DependencyInjection\IHttpClientBuilder.cs (1)
9/// A builder for configuring named <see cref="HttpClient"/> instances returned by <see cref="IHttpClientFactory"/>.
DependencyInjection\ISocketsHttpHandlerBuilder.cs (1)
9/// <see cref="System.Net.Http.HttpClient"/> instances returned by <see cref="System.Net.Http.IHttpClientFactory"/>.
DependencyInjection\SocketsHttpHandlerBuilderExtensions.cs (3)
16/// <see cref="System.Net.Http.HttpClient"/> instances returned by <see cref="IHttpClientFactory"/>. 22/// named <see cref="HttpClient"/>. 48/// named <see cref="HttpClient"/>.
HttpClientFactoryExtensions.cs (3)
14/// Creates a new <see cref="HttpClient"/> using the default configuration. 17/// <returns>An <see cref="HttpClient"/> configured using the default configuration.</returns> 18public static HttpClient CreateClient(this IHttpClientFactory factory)
HttpClientFactoryOptions.cs (4)
31/// Gets a list of operations used to configure an <see cref="HttpClient"/>. 33public IList<Action<HttpClient>> HttpClientActions { get; } = new List<Action<HttpClient>>(); 55/// <see cref="HttpClient"/> instances will prevent the underlying <see cref="HttpMessageHandler"/> from being
HttpMessageHandlerBuilder.cs (3)
23/// Gets or sets the name of the <see cref="HttpClient"/> being created. 40/// <see cref="HttpClient"/> pipeline. 68/// end of the chain. The resulting pipeline is used by <see cref="IHttpClientFactory"/> infrastructure to create <see cref="HttpClient"/> instances with customized message
IHttpClientFactory.cs (8)
9/// A factory abstraction for a component that can create <see cref="HttpClient"/> instances with custom 20/// Creates and configures an <see cref="HttpClient"/> instance using the configuration that corresponds 24/// <returns>A new <see cref="HttpClient"/> instance.</returns> 27/// Each call to <see cref="CreateClient(string)"/> is guaranteed to return a new <see cref="HttpClient"/> 28/// instance. It is generally not necessary to dispose of the <see cref="HttpClient"/> as the 29/// <see cref="IHttpClientFactory"/> tracks and disposes resources used by the <see cref="HttpClient"/>. 32/// Callers are also free to mutate the returned <see cref="HttpClient"/> instance's public properties 36HttpClient CreateClient(string name);
ITypedHttpClientFactory.cs (3)
103/// Creates a typed client given an associated <see cref="HttpClient"/>. 106/// An <see cref="HttpClient"/> created by the <see cref="IHttpClientFactory"/> for the named client 110TClient CreateClient(HttpClient httpClient);
Logging\IHttpClientAsyncLogger.cs (2)
12/// An abstraction for asyncronous custom HTTP request logging for a named <see cref="HttpClient"/> instances returned by <see cref="IHttpClientFactory"/>. 17/// <see cref="HttpClient.SendAsync(HttpRequestMessage, CancellationToken)"/>), and their
Logging\IHttpClientLogger.cs (1)
10/// An abstraction for custom HTTP request logging for a named <see cref="HttpClient"/> instances returned by <see cref="IHttpClientFactory"/>.
Microsoft.Extensions.Http.Diagnostics (8)
Latency\HttpClientLatencyTelemetryOptions.cs (1)
14/// Gets or sets a value indicating whether to collect detailed latency breakdown of <see cref="HttpClient"/> call.
Logging\HttpClientLoggingHttpClientBuilderExtensions.cs (6)
25/// Adds an <see cref="IHttpClientAsyncLogger" /> to emit logs for outgoing requests for a named <see cref="HttpClient"/>. 42/// Adds an <see cref="IHttpClientAsyncLogger" /> to emit logs for outgoing requests for a named <see cref="HttpClient"/>. 64/// Adds an <see cref="IHttpClientAsyncLogger" /> to emit logs for outgoing requests for a named <see cref="HttpClient"/>. 83/// Adds an <see cref="IHttpClientAsyncLogger" /> to emit logs for outgoing requests for a named <see cref="HttpClient"/>. 107/// Adds an <see cref="IHttpClientAsyncLogger" /> to emit logs for outgoing requests for a named <see cref="HttpClient"/>. 126/// Adds an <see cref="IHttpClientAsyncLogger" /> to emit logs for outgoing requests for a named <see cref="HttpClient"/>.
Logging\HttpClientLoggingServiceCollectionExtensions.cs (1)
96/// Adds an enricher instance of <typeparamref name="T"/> to the <see cref="IServiceCollection"/> to enrich <see cref="HttpClient"/> logs.
Microsoft.Extensions.Http.Diagnostics.PerformanceTests (32)
Benchmarks\HugeHttpCLientLoggingBenchmark.cs (8)
19private static readonly HttpClient _hugeNoLog 22private static readonly HttpClient _hugeLogAll 25private static readonly HttpClient _hugeLogRequest 28private static readonly HttpClient _hugeLogResponse 31private static readonly HttpClient _hugeNoLogChunked 34private static readonly HttpClient _hugeLogAllChunked 37private static readonly HttpClient _hugeLogRequestChunked 40private static readonly HttpClient _hugeLogResponseChunked
Benchmarks\MediumHttpClientLoggingBenchmark.cs (8)
19private static readonly HttpClient _mediumNoLog 22private static readonly HttpClient _mediumLogAll 25private static readonly HttpClient _mediumLogRequest 28private static readonly HttpClient _mediumLogResponse 31private static readonly HttpClient _mediumNoLogChunked 34private static readonly HttpClient _mediumLogAllChunked 37private static readonly HttpClient _mediumLogRequestChunked 40private static readonly HttpClient _mediumLogResponseChunked
Benchmarks\SmallHttpClientLoggingBenchmark.cs (8)
19private static readonly HttpClient _smallNoLog 22private static readonly HttpClient _smallLogAll 25private static readonly HttpClient _smallLogRequest 28private static readonly HttpClient _smallLogResponse 31private static readonly HttpClient _smallNoLogChunked 34private static readonly HttpClient _smallLogAllChunked 37private static readonly HttpClient _smallLogRequestChunked 40private static readonly HttpClient _smallLogResponseChunked
HttpClientFactory.cs (8)
14public static HttpClient CreateWithLoggingLogRequest(string fileName, int readLimit) 38public static HttpClient CreateWithLoggingLogResponse(string fileName, int readLimit) 61public static HttpClient CreateWithLoggingLogAll(string fileName, int readLimit) 88public static HttpClient CreateWithLoggingLogRequest_ChunkedEncoding(string fileName, int readLimit) 111public static HttpClient CreateWithLoggingLogResponse_ChunkedEncoding(string fileName, int readLimit) 134public static HttpClient CreateWithLoggingLogAll_ChunkedEncoding(string fileName, int readLimit) 161public static HttpClient CreateWithoutLogging(string fileName) 171public static HttpClient CreateWithoutLogging_ChunkedEncoding(string fileName)
Microsoft.Extensions.Http.Diagnostics.Tests (44)
Latency\HttpClientLatencyTelemetryExtensionsTest.cs (1)
66using var httpClient = sp.GetRequiredService<IHttpClientFactory>().CreateClient();
Latency\Internal\HttpLatencyMediatorTests.cs (1)
82using var client = new HttpClient(handler);
Latency\Internal\HttpLatencyTelemetryHandlerTest.cs (1)
80using var client = new HttpClient(handler);
Logging\AcceptanceTests.cs (15)
39using var httpClient = sp.GetRequiredService<IHttpClientFactory>().CreateClient(); 70using var httpClient = sp.GetRequiredService<IHttpClientFactory>().CreateClient(); 106using var httpClient = sp.GetRequiredService<IHttpClientFactory>().CreateClient("testClient"); 159using var namedClient1 = provider.GetRequiredService<IHttpClientFactory>().CreateClient("namedClient1"); 160using var namedClient2 = provider.GetRequiredService<IHttpClientFactory>().CreateClient("namedClient2"); 195private static async Task<string> SendRequest(HttpClient httpClient, HttpRequestMessage httpRequestMessage) 307using var httpClient = sp.GetRequiredService<IHttpClientFactory>().CreateClient(); 354using var httpClient = sp.GetRequiredService<IHttpClientFactory>().CreateClient(); 419using var httpClient = sp.GetRequiredService<IHttpClientFactory>().CreateClient("test"); 467var firstClient = factory.CreateClient(FirstClientName); 468var secondClient = factory.CreateClient(SecondClientName); 590var client = provider.GetRequiredService<IHttpClientFactory>().CreateClient("test"); 616var client = provider.GetRequiredService<IHttpClientFactory>().CreateClient("normal"); 639var client = provider.GetRequiredService<IHttpClientFactory>().CreateClient("test"); 677var client = provider
Logging\HttpClientLoggerTest.cs (15)
70using var client = new HttpClient(handler); 105using var client = new HttpClient(handler); 148using var httpClient = new HttpClient(handler); 237using var client = new HttpClient(handler); 277using var client = new HttpClient(handler); 363using var client = new HttpClient(handler); 467using var client = new HttpClient(handler); 583using var client = new HttpClient(handler); 677using var client = new HttpClient(handler); 721using var client = new HttpClient(handler); 764using var client = new HttpClient(handler); 802using var client = new HttpClient(handler); 846using var client = new HttpClient(handler); 952using var client = new HttpClient(handler); 993using var client = new HttpClient(handler);
Logging\HttpClientLoggingExtensionsTest.cs (7)
370using var client = provider.GetRequiredService<IHttpClientFactory>().CreateClient("test"); 524using var httpClient = provider.GetRequiredService<IHttpClientFactory>().CreateClient(); 607using var httpClient = provider.GetRequiredService<IHttpClientFactory>().CreateClient(); 646using var httpClient = sp.GetRequiredService<IHttpClientFactory>().CreateClient(); 669var client = sp.GetRequiredService<IHttpClientFactory>().CreateClient("test"); 719var outerClient = factory.CreateClient("outer"); 728var innerClient = factory.CreateClient("inner");
Logging\Internal\TestHttpClient1.cs (2)
11private readonly System.Net.Http.HttpClient _httpClient; 13public TestHttpClient1(System.Net.Http.HttpClient httpClient)
Logging\Internal\TestHttpClient2.cs (2)
11private readonly System.Net.Http.HttpClient _httpClient; 13public TestHttpClient2(System.Net.Http.HttpClient httpClient)
Microsoft.Extensions.Http.Polly (3)
DependencyInjection\PollyHttpClientBuilderExtensions.cs (1)
15/// and <see cref="HttpClient"/> message handler pipeline.
PolicyHttpMessageHandler.cs (2)
55/// <see cref="HttpClient.Timeout"/>. When combining Retry and Timeout, <see cref="HttpClient.Timeout"/> will act as a
Microsoft.Extensions.Http.Resilience.PerformanceTests (10)
HedgingBenchmark.cs (1)
18private HttpClient _client = null!;
HttpResilienceBenchmark.cs (5)
17private HttpClient _client = null!; 18private HttpClient _standardClient = null!; 19private HttpClient _singleHandlerClient = null!; 20private HttpClient _hedgingClientOrdered = null!; 21private HttpClient _hedgingClientNoRoutes = null!;
RetryBenchmark.cs (2)
21private HttpClient _v7 = null!; 22private HttpClient _v8 = null!;
StandardResilienceBenchmark.cs (2)
21private HttpClient _v7 = null!; 22private HttpClient _v8 = null!;
Microsoft.Extensions.Http.Resilience.Tests (26)
Hedging\HedgingTests.cs (11)
105using var client = CreateClientWithHandler(); 122using var client = CreateClientWithHandler(); 149using var client = CreateClientWithHandler(); 171using var client = CreateClientWithHandler(); 198using var client = CreateClientWithHandler(); 222using var client = CreateClientWithHandler(); 248using var client = CreateClientWithHandler(); 275using var client = CreateClientWithHandler(); 298using var client = CreateClientWithHandler(); 309HttpClient client, HttpRequestMessage request, bool asynchronous, CancellationToken cancellationToken = default) 341protected HttpClient CreateClientWithHandler()
Hedging\StandardHedgingTests.cs (5)
222using var client = CreateClientWithHandler(); 252var client = CreateClientWithHandler(); 271var client = CreateClientWithHandler(); 287var client = CreateClientWithHandler(); 337using var client = clientFactory.CreateClient(ClientId);
Resilience\HttpClientBuilderExtensionsTests.BySelector.cs (1)
135var client = CreateClient();
Resilience\HttpClientBuilderExtensionsTests.Resilience.cs (5)
80var client = serviceProvider.GetRequiredService<IHttpClientFactory>().CreateClient("client"); 133var client = clientBuilder.Services.BuildServiceProvider().GetRequiredService<IHttpClientFactory>().CreateClient("client"); 161var client = CreateClient(BuilderName); 230var client = provider.GetRequiredService<IHttpClientFactory>().CreateClient("client"); 265var client = provider.GetRequiredService<IHttpClientFactory>().CreateClient("client");
Resilience\HttpClientBuilderExtensionsTests.Standard.cs (4)
39private static Task<HttpResponseMessage> SendRequest(HttpClient client, string url, bool asynchronous) 57private HttpClient CreateClient(string name = BuilderName) 248var client = CreateClient(); 266using var client = builder.Services.BuildServiceProvider().GetRequiredService<IHttpClientFactory>().CreateClient("test");
Microsoft.Extensions.Logging.AzureAppServices (3)
BlobAppendReferenceWrapper.cs (2)
16private readonly HttpClient _client; 19public BlobAppendReferenceWrapper(string containerUrl, string name, HttpClient client)
BlobLoggerProvider.cs (1)
24private readonly HttpClient _httpClient;
Microsoft.Extensions.ML (2)
ModelLoaders\UriModelLoader.cs (2)
107using (var client = new HttpClient()) 141using (var client = new HttpClient())
Microsoft.Extensions.ServiceDiscovery.Tests (1)
ServiceEndpointResolverTests.cs (1)
62var client = services.GetRequiredService<IHttpClientFactory>().CreateClient("foo");
Microsoft.Maui.Controls (2)
StreamWrapper.cs (1)
93 public static async Task<Stream> GetStreamAsync(Uri uri, CancellationToken cancellationToken, HttpClient client)
UriImageSource.cs (1)
117 using var client = new HttpClient();
Microsoft.ML.AutoML.Tests (1)
DatasetUtil.cs (1)
208using (var client = new HttpClient())
Microsoft.ML.Core (2)
Utilities\ResourceManagerUtils.cs (2)
157using (var client = new HttpClient()) 249private async Task<Exception> DownloadResource(IHostEnvironment env, IChannel ch, HttpClient httpClient, Uri uri, string path, string fileName, CancellationToken ct)
Microsoft.ML.PerformanceTests (1)
ImageClassificationBench.cs (1)
159using (HttpClient client = new HttpClient())
Microsoft.ML.Samples (5)
Dynamic\TensorFlow\ImageClassification.cs (1)
123using (HttpClient client = new HttpClient())
Dynamic\Trainers\MulticlassClassification\ImageClassification\ImageClassificationDefault.cs (1)
272using (HttpClient client = new HttpClient())
Dynamic\Trainers\MulticlassClassification\ImageClassification\LearningRateSchedulingCifarResnetTransferLearning.cs (1)
304using (HttpClient client = new HttpClient())
Dynamic\Trainers\MulticlassClassification\ImageClassification\ResnetV2101TransferLearningEarlyStopping.cs (1)
260using (HttpClient client = new HttpClient())
Dynamic\Trainers\MulticlassClassification\ImageClassification\ResnetV2101TransferLearningTrainTestSplit.cs (1)
281using (HttpClient client = new HttpClient())
Microsoft.ML.Samples.GPU (5)
parent\6a273e5f1a281752\LearningRateSchedulingCifarResnetTransferLearning.cs (1)
304using (HttpClient client = new HttpClient())
parent\Microsoft.ML.Samples\Dynamic\TensorFlow\ImageClassification.cs (1)
123using (HttpClient client = new HttpClient())
parent\Microsoft.ML.Samples\Dynamic\Trainers\MulticlassClassification\ImageClassification\ImageClassificationDefault.cs (1)
272using (HttpClient client = new HttpClient())
parent\Microsoft.ML.Samples\Dynamic\Trainers\MulticlassClassification\ImageClassification\ResnetV2101TransferLearningEarlyStopping.cs (1)
260using (HttpClient client = new HttpClient())
parent\Microsoft.ML.Samples\Dynamic\Trainers\MulticlassClassification\ImageClassification\ResnetV2101TransferLearningTrainTestSplit.cs (1)
281using (HttpClient client = new HttpClient())
Microsoft.ML.SamplesUtils (1)
SamplesDatasetUtils.cs (1)
196using (HttpClient client = new HttpClient())
Microsoft.ML.TestFrameworkCommon (1)
TestDownloadUtils.cs (1)
21using (var client = new HttpClient { Timeout = Timeout.InfiniteTimeSpan })
Microsoft.ML.Tokenizers (2)
Utils\Helpers.netcoreapp.cs (2)
26public static Task<Stream> GetStreamAsync(HttpClient client, string url, CancellationToken cancellationToken = default) => 29public static Stream GetStream(HttpClient client, string url)
Microsoft.ML.Tokenizers.Data.Tests (1)
parent\Microsoft.ML.Tokenizers.Tests\Utils.cs (1)
17using (var client = new HttpClient() { Timeout = TimeSpan.FromMinutes(5) })
Microsoft.ML.Tokenizers.Tests (4)
LlamaTests.cs (1)
21private static readonly HttpClient _httpClient = new HttpClient() { Timeout = TimeSpan.FromMinutes(5) };
parent\parent\src\Microsoft.ML.Tokenizers\Utils\Helpers.netcoreapp.cs (2)
26public static Task<Stream> GetStreamAsync(HttpClient client, string url, CancellationToken cancellationToken = default) => 29public static Stream GetStream(HttpClient client, string url)
Utils.cs (1)
17using (var client = new HttpClient() { Timeout = TimeSpan.FromMinutes(5) })
Microsoft.NET.Build.Containers (9)
Registry\DefaultBlobOperations.cs (2)
15private readonly HttpClient _client; 19public DefaultBlobOperations(Uri baseUri, string registryName, HttpClient client, ILogger logger)
Registry\DefaultBlobUploadOperations.cs (2)
14private readonly HttpClient _client; 17internal DefaultBlobUploadOperations(Uri baseUri, HttpClient client, ILogger logger)
Registry\DefaultManifestOperations.cs (2)
15private readonly HttpClient _client; 19internal DefaultManifestOperations(Uri baseUri, string registryName, HttpClient client, ILogger logger)
Registry\DefaultRegistryAPI.cs (3)
13private readonly HttpClient _client; 37private static HttpClient CreateClient(string registryName, Uri baseUri, ILogger logger, bool isInsecureRegistry, RegistryMode mode) 48HttpClient client = new(clientHandler)
Microsoft.NET.Sdk.Publish.Tasks (3)
Kudu\KuduVfsDeploy.cs (1)
59using (var client = new HttpClient())
Kudu\KuduZipDeploy.cs (1)
50using (var client = new HttpClient())
Tasks\Http\DefaultHttpClient.cs (1)
11private readonly HttpClient _httpClient = new()
Microsoft.TemplateSearch.Common (1)
Providers\NuGetMetadataSearchProvider.cs (1)
177using HttpClient client = new(handler);
MyFrontend (1)
Services\CatalogServiceClient.cs (1)
5public class CatalogServiceClient(HttpClient client)
netstandard (1)
netstandard.cs (1)
1123[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Net.Http.HttpClient))]
NuGet.Packaging (1)
Signing\Timestamp\Rfc3161TimestampRequestNetstandard21Wrapper.cs (1)
17private static readonly HttpClient HttpClient = new HttpClient();
NuGet.Protocol (8)
HttpSource\HttpRetryHandlerRequest.cs (2)
19public HttpRetryHandlerRequest(HttpClient httpClient, Func<HttpRequestMessage> requestFactory) 41public HttpClient HttpClient { get; }
HttpSource\HttpSource.cs (5)
23private HttpClient? _httpClient; 337HttpClient httpClient = await GetHttpClientAsync(); 371private async Task<HttpClient> GetHttpClientAsync() 394private async Task<HttpClient> CreateHttpClientAsync() 397var httpClient = new HttpClient(httpHandler.MessageHandler)
UserAgent.cs (1)
34public static void SetUserAgent(HttpClient client)
Pipelines.Library (1)
DistributedApplicationPipelineExtensions.cs (1)
148using var httpClient = new HttpClient();
Publishers.Frontend (1)
Program.cs (1)
35public class ApiClient(HttpClient client)
StandardService (1)
Program.cs (1)
15var client = httpClientFactory.CreateClient("functions");
Stress.ApiService (1)
Program.cs (1)
165app.MapGet("/http-client-requests", async (HttpClient client) =>
System.Net.Http (4)
System\Net\Http\HttpContent.cs (1)
786/// already knows the final size and needs a new array anyway (e.g. <see cref="HttpClient.GetByteArrayAsync(string?)"/>).
System\Net\Http\HttpProtocolException.cs (1)
13/// When calling <see cref="HttpClient"/> or <see cref="SocketsHttpHandler"/> methods, <see cref="HttpProtocolException"/> will be the inner exception of
System\Net\Http\HttpRequestError.cs (1)
67/// The response exceeded a pre-configured limit such as <see cref="HttpClient.MaxResponseContentBufferSize"/> or <see cref="HttpClientHandler.MaxResponseHeadersLength"/>.
System\Net\Http\SocketsHttpHandler\HttpConnectionPoolManager.cs (1)
154_proxy = settings._proxy ?? HttpClient.DefaultProxy;
System.Net.Http.Json (66)
System\Net\Http\Json\HttpClientJsonExtensions.cs (13)
19private static Task<object?> FromJsonAsyncCore(Func<HttpClient, Uri?, CancellationToken, Task<HttpResponseMessage>> getMethod, HttpClient client, Uri? requestUri, Type type, JsonSerializerOptions? options, CancellationToken cancellationToken = default) => 24private static Task<TValue?> FromJsonAsyncCore<TValue>(Func<HttpClient, Uri?, CancellationToken, Task<HttpResponseMessage>> getMethod, HttpClient client, Uri? requestUri, JsonSerializerOptions? options, CancellationToken cancellationToken = default) => 27private static Task<object?> FromJsonAsyncCore(Func<HttpClient, Uri?, CancellationToken, Task<HttpResponseMessage>> getMethod, HttpClient client, Uri? requestUri, Type type, JsonSerializerContext context, CancellationToken cancellationToken = default) => 30private static Task<TValue?> FromJsonAsyncCore<TValue>(Func<HttpClient, Uri?, CancellationToken, Task<HttpResponseMessage>> getMethod, HttpClient client, Uri? requestUri, JsonTypeInfo<TValue> jsonTypeInfo, CancellationToken cancellationToken) => 34Func<HttpClient, Uri?, CancellationToken, Task<HttpResponseMessage>> getMethod, 35HttpClient client, 73HttpClient client, 115HttpClient client, 135private static async ValueTask<Stream> GetLengthLimitReadStreamAsync(HttpClient client, ValueTask<Stream> task)
System\Net\Http\Json\HttpClientJsonExtensions.Delete.cs (13)
18private static readonly Func<HttpClient, Uri?, CancellationToken, Task<HttpResponseMessage>> s_deleteAsync = 33public static Task<object?> DeleteFromJsonAsync(this HttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, Type type, JsonSerializerOptions? options, CancellationToken cancellationToken = default) => 48public static Task<object?> DeleteFromJsonAsync(this HttpClient client, Uri? requestUri, Type type, JsonSerializerOptions? options, CancellationToken cancellationToken = default) => 63public static Task<TValue?> DeleteFromJsonAsync<TValue>(this HttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, JsonSerializerOptions? options, CancellationToken cancellationToken = default) => 78public static Task<TValue?> DeleteFromJsonAsync<TValue>(this HttpClient client, Uri? requestUri, JsonSerializerOptions? options, CancellationToken cancellationToken = default) => 91public static Task<object?> DeleteFromJsonAsync(this HttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, Type type, JsonSerializerContext context, CancellationToken cancellationToken = default) => 104public static Task<object?> DeleteFromJsonAsync(this HttpClient client, Uri? requestUri, Type type, JsonSerializerContext context, CancellationToken cancellationToken = default) => 117public static Task<TValue?> DeleteFromJsonAsync<TValue>(this HttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, JsonTypeInfo<TValue> jsonTypeInfo, CancellationToken cancellationToken = default) => 130public static Task<TValue?> DeleteFromJsonAsync<TValue>(this HttpClient client, Uri? requestUri, JsonTypeInfo<TValue> jsonTypeInfo, CancellationToken cancellationToken = default) => 144public static Task<object?> DeleteFromJsonAsync(this HttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, Type type, CancellationToken cancellationToken = default) => 158public static Task<object?> DeleteFromJsonAsync(this HttpClient client, Uri? requestUri, Type type, CancellationToken cancellationToken = default) => 172public static Task<TValue?> DeleteFromJsonAsync<TValue>(this HttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, CancellationToken cancellationToken = default) => 186public static Task<TValue?> DeleteFromJsonAsync<TValue>(this HttpClient client, Uri? requestUri, CancellationToken cancellationToken = default) =>
System\Net\Http\Json\HttpClientJsonExtensions.Get.AsyncEnumerable.cs (9)
32this HttpClient client, 52this HttpClient client, 70this HttpClient client, 88this HttpClient client, 107this HttpClient client, 125this HttpClient client, 133HttpClient client, 144HttpClient client, 154HttpClient client,
System\Net\Http\Json\HttpClientJsonExtensions.Get.cs (13)
18private static readonly Func<HttpClient, Uri?, CancellationToken, Task<HttpResponseMessage>> s_getAsync = 23public static Task<object?> GetFromJsonAsync(this HttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, Type type, JsonSerializerOptions? options, CancellationToken cancellationToken = default) => 28public static Task<object?> GetFromJsonAsync(this HttpClient client, Uri? requestUri, Type type, JsonSerializerOptions? options, CancellationToken cancellationToken = default) => 33public static Task<TValue?> GetFromJsonAsync<TValue>(this HttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, JsonSerializerOptions? options, CancellationToken cancellationToken = default) => 38public static Task<TValue?> GetFromJsonAsync<TValue>(this HttpClient client, Uri? requestUri, JsonSerializerOptions? options, CancellationToken cancellationToken = default) => 41public static Task<object?> GetFromJsonAsync(this HttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, Type type, JsonSerializerContext context, CancellationToken cancellationToken = default) => 44public static Task<object?> GetFromJsonAsync(this HttpClient client, Uri? requestUri, Type type, JsonSerializerContext context, CancellationToken cancellationToken = default) => 47public static Task<TValue?> GetFromJsonAsync<TValue>(this HttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, JsonTypeInfo<TValue> jsonTypeInfo, CancellationToken cancellationToken = default) => 50public static Task<TValue?> GetFromJsonAsync<TValue>(this HttpClient client, Uri? requestUri, JsonTypeInfo<TValue> jsonTypeInfo, CancellationToken cancellationToken = default) => 55public static Task<object?> GetFromJsonAsync(this HttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, Type type, CancellationToken cancellationToken = default) => 60public static Task<object?> GetFromJsonAsync(this HttpClient client, Uri? requestUri, Type type, CancellationToken cancellationToken = default) => 65public static Task<TValue?> GetFromJsonAsync<TValue>(this HttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, CancellationToken cancellationToken = default) => 70public static Task<TValue?> GetFromJsonAsync<TValue>(this HttpClient client, Uri? requestUri, CancellationToken cancellationToken = default) =>
System\Net\Http\Json\HttpClientJsonExtensions.Patch.cs (6)
27public static Task<HttpResponseMessage> PatchAsJsonAsync<TValue>(this HttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, TValue value, JsonSerializerOptions? options = null, CancellationToken cancellationToken = default) 48public static Task<HttpResponseMessage> PatchAsJsonAsync<TValue>(this HttpClient client, Uri? requestUri, TValue value, JsonSerializerOptions? options = null, CancellationToken cancellationToken = default) 68public static Task<HttpResponseMessage> PatchAsJsonAsync<TValue>(this HttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, TValue value, CancellationToken cancellationToken) 83public static Task<HttpResponseMessage> PatchAsJsonAsync<TValue>(this HttpClient client, Uri? requestUri, TValue value, CancellationToken cancellationToken) 97public static Task<HttpResponseMessage> PatchAsJsonAsync<TValue>(this HttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, TValue value, JsonTypeInfo<TValue> jsonTypeInfo, CancellationToken cancellationToken = default) 116public static Task<HttpResponseMessage> PatchAsJsonAsync<TValue>(this HttpClient client, Uri? requestUri, TValue value, JsonTypeInfo<TValue> jsonTypeInfo, CancellationToken cancellationToken = default)
System\Net\Http\Json\HttpClientJsonExtensions.Post.cs (6)
16public static Task<HttpResponseMessage> PostAsJsonAsync<TValue>(this HttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, TValue value, JsonSerializerOptions? options = null, CancellationToken cancellationToken = default) 26public static Task<HttpResponseMessage> PostAsJsonAsync<TValue>(this HttpClient client, Uri? requestUri, TValue value, JsonSerializerOptions? options = null, CancellationToken cancellationToken = default) 36public static Task<HttpResponseMessage> PostAsJsonAsync<TValue>(this HttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, TValue value, CancellationToken cancellationToken) 41public static Task<HttpResponseMessage> PostAsJsonAsync<TValue>(this HttpClient client, Uri? requestUri, TValue value, CancellationToken cancellationToken) 44public static Task<HttpResponseMessage> PostAsJsonAsync<TValue>(this HttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, TValue value, JsonTypeInfo<TValue> jsonTypeInfo, CancellationToken cancellationToken = default) 52public static Task<HttpResponseMessage> PostAsJsonAsync<TValue>(this HttpClient client, Uri? requestUri, TValue value, JsonTypeInfo<TValue> jsonTypeInfo, CancellationToken cancellationToken = default)
System\Net\Http\Json\HttpClientJsonExtensions.Put.cs (6)
16public static Task<HttpResponseMessage> PutAsJsonAsync<TValue>(this HttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, TValue value, JsonSerializerOptions? options = null, CancellationToken cancellationToken = default) 26public static Task<HttpResponseMessage> PutAsJsonAsync<TValue>(this HttpClient client, Uri? requestUri, TValue value, JsonSerializerOptions? options = null, CancellationToken cancellationToken = default) 36public static Task<HttpResponseMessage> PutAsJsonAsync<TValue>(this HttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, TValue value, CancellationToken cancellationToken) 41public static Task<HttpResponseMessage> PutAsJsonAsync<TValue>(this HttpClient client, Uri? requestUri, TValue value, CancellationToken cancellationToken) 44public static Task<HttpResponseMessage> PutAsJsonAsync<TValue>(this HttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, TValue value, JsonTypeInfo<TValue> jsonTypeInfo, CancellationToken cancellationToken = default) 52public static Task<HttpResponseMessage> PutAsJsonAsync<TValue>(this HttpClient client, Uri? requestUri, TValue value, JsonTypeInfo<TValue> jsonTypeInfo, CancellationToken cancellationToken = default)
System.Net.Requests (6)
System\Net\HttpWebRequest.cs (5)
86private static HttpClient? s_cachedHttpClient; 89private HttpClient? _httpClient; 1657private HttpClient GetCachedOrCreateHttpClient(bool async, out bool disposeRequired) 1686private static HttpClient CreateHttpClient(HttpClientParameters parameters, HttpWebRequest? request) 1688HttpClient? client = null;
System\Net\WebRequest.cs (1)
548public static IWebProxy GetSystemWebProxy() => HttpClient.DefaultProxy;
System.Private.Xml (1)
System\Xml\XmlDownloadManager.cs (1)
43using (var client = new HttpClient(handler))
System.ServiceModel.Http (14)
System\ServiceModel\Channels\HttpChannelFactory.cs (8)
37private volatile MruCache<string, HttpClient> _httpClientCache; 133_httpClientCache = bindingElement.GetProperty<MruCache<string, HttpClient>>(context); 245internal async Task<HttpClient> GetHttpClientAsync(EndpointAddress to, Uri via, 252HttpClient httpClient; 365HttpClient tempHttpClient; 913internal virtual Task<HttpClient> GetHttpClientAsync(EndpointAddress to, Uri via, TimeoutHelper timeoutHelper) 918protected async Task<HttpClient> GetHttpClientAsync(EndpointAddress to, Uri via, SecurityTokenContainer clientCertificateToken, TimeoutHelper timeoutHelper) 981private HttpClient _httpClient;
System\ServiceModel\Channels\HttpsChannelFactory.cs (2)
391internal override async Task<HttpClient> GetHttpClientAsync(EndpointAddress to, Uri via, TimeoutHelper timeoutHelper) 394HttpClient httpClient = await GetHttpClientAsync(to, via, clientCertificateToken, timeoutHelper);
System\ServiceModel\Channels\HttpTransportBindingElement.cs (4)
28private MruCache<string, HttpClient> _httpClientCache; 282else if (typeof(T) == typeof(MruCache<string, HttpClient>)) 304private MruCache<string, HttpClient> EnsureHttpClientCache() 308_httpClientCache = new MruCache<string, HttpClient>(10);
System.Windows.Forms (1)
System\Windows\Forms\Controls\PictureBox\PictureBox.cs (1)
28private static readonly HttpClient s_httpClient = !AppContextSwitches.ServicePointManagerCheckCrl ? new() :
WaitFor.Frontend (1)
Program.cs (1)
35public class ApiClient(HttpClient client)
Yarp.Frontend (1)
Program.cs (1)
20var client = httpClientFactory.CreateClient("gateway-client");