232 instantiations of HttpClient
aspire (1)
Utils\CliDownloader.cs (1)
29private static readonly HttpClient s_httpClient = new();
Aspire.Cli.Tests (18)
Mcp\Docs\DocsFetcherTests.cs (16)
30using var httpClient = new HttpClient(handler); 50using var httpClient = new HttpClient(handler); 71using var httpClient = new HttpClient(handler); 98using var httpClient = new HttpClient(handler); 120using var httpClient = new HttpClient(handler); 155using var httpClient = new HttpClient(handler); 173using var httpClient = new HttpClient(handler); 186using var httpClient = new HttpClient(handler); 200using var httpClient = new HttpClient(handler); 222using var httpClient = new HttpClient(handler); 242using var httpClient = new HttpClient(handler); 261using var httpClient = new HttpClient(handler); 284using var httpClient = new HttpClient(handler); 305using var httpClient = new HttpClient(handler); 325using var httpClient = new HttpClient(handler); 358using var httpClient = new HttpClient(handler);
TestServices\TestHttpClientFactory.cs (1)
13return new HttpClient();
Utils\MockHttpClientFactory.cs (1)
19return new HttpClient(handler, disposeHandler: false);
Aspire.Dashboard (2)
Model\Assistant\ChatClientFactory.cs (1)
215httpClient = new HttpClient(handler) { Timeout = Timeout.InfiniteTimeSpan };
Model\DebugSessionHelpers.cs (1)
38var client = new HttpClient(resolvedHandler)
Aspire.Dashboard.Tests (26)
Integration\FrontendBrowserTokenAuthTests.cs (5)
39using var client = new HttpClient { BaseAddress = new Uri($"http://{app.FrontendSingleEndPointAccessor().EndPoint}") }; 61using var client = new HttpClient { BaseAddress = new Uri($"http://{app.FrontendSingleEndPointAccessor().EndPoint}") }; 92using var client = new HttpClient { BaseAddress = new Uri($"http://{app.OtlpServiceHttpEndPointAccessor().EndPoint}") }; 116using var client = new HttpClient { BaseAddress = new Uri($"http://{app.FrontendSingleEndPointAccessor().EndPoint}") }; 141using 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 (1)
27using var client = new HttpClient(httpClientHandler) { BaseAddress = new Uri(basePath) };
Integration\IntegrationTestHelpers.cs (1)
135return new HttpClient(handler) { BaseAddress = new Uri(address) };
Integration\OtlpHttpServiceTests.cs (6)
231using var client = new HttpClient { BaseAddress = new Uri($"http://{endpoint.EndPoint}") }; 262using var client = new HttpClient { BaseAddress = new Uri($"http://{endpoint.EndPoint}") }; 309using var client = new HttpClient { BaseAddress = new Uri($"http://{endpoint.EndPoint}") }; 334using var client = new HttpClient { BaseAddress = new Uri($"http://{endpoint.EndPoint}") }; 363using var client = new HttpClient { BaseAddress = new Uri($"http://{endpoint.EndPoint}") }; 392using var client = new HttpClient { BaseAddress = new Uri($"http://{endpoint.EndPoint}") };
Integration\ResponseCompressionTests.cs (2)
22using var client = new HttpClient(httpClientHandler) { BaseAddress = new Uri($"http://{app.FrontendSingleEndPointAccessor().EndPoint}") }; 44using var client = new HttpClient(httpClientHandler) { BaseAddress = new Uri($"http://{app.FrontendSingleEndPointAccessor().EndPoint}") };
Integration\StartupTests.cs (6)
332using var httpClient = new HttpClient(new HttpClientHandler 388using var browserHttpClient = new HttpClient(new HttpClientHandler 409using var mcpHttpClient = new HttpClient(new HttpClientHandler 519using var httpClient = new HttpClient() 984using var client = new HttpClient { BaseAddress = new Uri($"http://{app.FrontendSingleEndPointAccessor().EndPoint}") }; 1061using var client = new HttpClient { BaseAddress = new Uri($"http://{endpointString}") };
Integration\TelemetryApiTests.cs (3)
102using var httpClient = new HttpClient(handler) { BaseAddress = new Uri($"http://{app.FrontendSingleEndPointAccessor().EndPoint}") }; 174using var httpClient = new HttpClient(handler) { BaseAddress = new Uri($"http://{app.FrontendSingleEndPointAccessor().EndPoint}") }; 343using var httpClient = new HttpClient(handler) { BaseAddress = new Uri($"http://{app.FrontendSingleEndPointAccessor().EndPoint}") };
Aspire.Hosting (1)
Backchannel\AuxiliaryBackchannelRpcTarget.cs (1)
903var httpClient = httpClientFactory?.CreateClient() ?? new HttpClient();
Aspire.Hosting.Seq.Tests (1)
SeqFunctionalTests.cs (1)
42HttpClient client = new()
Aspire.Hosting.Tests (4)
DistributedApplicationTests.cs (4)
649using var clientB = new HttpClient(); 1525using var client2 = new HttpClient(new SocketsHttpHandler 1572using var client = new HttpClient(); 1592using var client = new HttpClient();
Aspire.Playground.Tests (1)
Infrastructure\DistributedApplicationExtensions.cs (1)
183var httpClient = new HttpClient
Aspire.Seq (1)
SeqHealthCheck.cs (1)
14readonly HttpClient _client = new(new SocketsHttpHandler { ActivityHeadersPropagator = null }) { BaseAddress = new Uri(seqUri) };
Aspire.Templates.Tests (1)
StarterTemplateRunTestsBase.cs (1)
83using var httpClient = new HttpClient();
dotnet (2)
Commands\Workload\Install\WorkloadManifestUpdater.cs (1)
505using HttpClient httpClient = new();
NugetSearch\NugetToolSearchApiRequest.cs (1)
23var httpClient = 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)
574using (HttpClient httpClient = new HttpClient()) 593using (HttpClient httpClient = new HttpClient()) 612using (HttpClient httpClient = new HttpClient())
installer.tasks (1)
StaticFileRegeneration\RegenerateThirdPartyNotices.cs (1)
41using (var client = new HttpClient())
Microsoft.AspNetCore.Authentication.OAuth (1)
OAuthPostConfigureOptions.cs (1)
38options.Backchannel = new HttpClient(options.BackchannelHttpHandler ?? new HttpClientHandler());
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.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)
152using (var httpClient = new HttpClient(handler))
Microsoft.DotNet.HotReload.WebAssembly.Browser (1)
WebAssemblyHotReload.cs (1)
89using var client = new HttpClient()
Microsoft.Extensions.AI.OpenAI.Tests (110)
OpenAIAssistantChatClientIntegrationTests.cs (1)
107using HttpClient client = new(new HttpClientHandler
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); 1222using HttpClient httpClient = new(handler); 1321using HttpClient httpClient = new(handler); 1461using HttpClient httpClient = new(handler); 1581using HttpClient httpClient = new(handler); 1628using HttpClient httpClient = new(handler); 1676using HttpClient httpClient = new(handler); 1722using HttpClient httpClient = new(handler); 1861using HttpClient httpClient = new(handler); 1906using HttpClient httpClient = new(handler); 1956using HttpClient httpClient = new(handler); 2013using 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);
OpenAIResponseClientTests.cs (74)
150using HttpClient httpClient = new(handler); 293using HttpClient httpClient = new(handler); 426using HttpClient httpClient = new(handler); 552using HttpClient httpClient = new(handler); 657using HttpClient httpClient = new(handler); 797using HttpClient httpClient = new(handler); 890using HttpClient httpClient = new(handler); 996using HttpClient httpClient = new(handler); 1141using HttpClient httpClient = new(handler); 1269using HttpClient httpClient = new(handler); 1403using (HttpClient httpClient = new(handler)) 1524using (HttpClient httpClient = new(handler)) 1769using HttpClient httpClient = new(handler); 2184using HttpClient httpClient = new(handler); 2307using HttpClient httpClient = new(handler); 2379using HttpClient httpClient = new(handler); 2468using HttpClient httpClient = new(handler); 2520using HttpClient httpClient = new(handler); 2615using HttpClient httpClient = new(handler); 2696using HttpClient httpClient = new(handler); 2763using HttpClient httpClient = new(handler); 2887using HttpClient httpClient = new(handler); 3107using HttpClient httpClient = new(handler); 3194using HttpClient httpClient = new(handler); 3263using HttpClient httpClient = new(handler); 3315using HttpClient httpClient = new(handler); 3373using HttpClient httpClient = new(handler); 3432using HttpClient httpClient = new(handler); 3493using HttpClient httpClient = new(handler); 3555using HttpClient httpClient = new(handler); 3618using HttpClient httpClient = new(handler); 3691using HttpClient httpClient = new(handler); 3772using HttpClient httpClient = new(handler); 3853using HttpClient httpClient = new(handler); 3931using HttpClient httpClient = new(handler); 3997using HttpClient httpClient = new(handler); 4058using HttpClient httpClient = new(handler); 4128using HttpClient httpClient = new(handler); 4187using HttpClient httpClient = new(handler); 4243using HttpClient httpClient = new(handler); 4304using HttpClient httpClient = new(handler); 4362using HttpClient httpClient = new(handler); 4419using HttpClient httpClient = new(handler); 4478using HttpClient httpClient = new(handler); 4540using HttpClient httpClient = new(handler); 4596using HttpClient httpClient = new(handler); 4651using HttpClient httpClient = new(handler); 4708using HttpClient httpClient = new(handler); 4765using HttpClient httpClient = new(handler); 4802using HttpClient httpClient = new(handler); 4834using HttpClient httpClient = new(handler); 4878using HttpClient httpClient = new(handler); 4929using HttpClient httpClient = new(handler); 4975using HttpClient httpClient = new(handler); 5010using HttpClient httpClient = new(handler); 5045using HttpClient httpClient = new(handler); 5080using HttpClient httpClient = new(handler); 5118using HttpClient httpClient = new(handler); 5156using HttpClient httpClient = new(handler); 5176using HttpClient httpClient = new(); 5214using HttpClient httpClient = new(handler); 5257using HttpClient httpClient = new(handler); 5300using HttpClient httpClient = new(handler); 5343using HttpClient httpClient = new(handler); 5418using HttpClient httpClient = new(handler); 5490using HttpClient httpClient = new(handler); 5531using HttpClient httpClient = new(handler); 5585using HttpClient httpClient = new(handler); 5648using HttpClient httpClient = new(handler); 5721using HttpClient httpClient = new(handler); 5821using HttpClient httpClient = new(handler); 5938using HttpClient httpClient = new(handler); 6068using HttpClient httpClient = new(handler); 6122using HttpClient httpClient = new(handler);
OpenAISpeechToTextClientTests.cs (7)
83using HttpClient httpClient = new(handler); 104using HttpClient httpClient = new(); 118using HttpClient httpClient = new(); 158using HttpClient httpClient = new(handler); 193using HttpClient httpClient = new(handler); 230using HttpClient httpClient = new(handler); 267using HttpClient httpClient = new(handler);
Microsoft.Extensions.DataIngestion.Tests (1)
Readers\DocumentReaderConformanceTests.cs (1)
18private 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 (14)
Logging\HttpClientLoggerTest.cs (14)
70using var client = new HttpClient(handler); 105using var client = new HttpClient(handler); 148using var httpClient = new HttpClient(handler); 237using var client = new HttpClient(handler); 334using var client = new HttpClient(handler); 438using var client = new HttpClient(handler); 554using var client = new HttpClient(handler); 648using var client = new HttpClient(handler); 692using var client = new HttpClient(handler); 735using var client = new HttpClient(handler); 773using var client = new HttpClient(handler); 817using var client = new HttpClient(handler); 923using var client = new HttpClient(handler); 964using var client = new HttpClient(handler);
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)
docs\samples\Microsoft.ML.Samples\Dynamic\TensorFlow\ImageClassification.cs (1)
123using (HttpClient client = new HttpClient())
docs\samples\Microsoft.ML.Samples\Dynamic\Trainers\MulticlassClassification\ImageClassification\ImageClassificationDefault.cs (1)
272using (HttpClient client = new HttpClient())
docs\samples\Microsoft.ML.Samples\Dynamic\Trainers\MulticlassClassification\ImageClassification\LearningRateSchedulingCifarResnetTransferLearning.cs (1)
304using (HttpClient client = new HttpClient())
docs\samples\Microsoft.ML.Samples\Dynamic\Trainers\MulticlassClassification\ImageClassification\ResnetV2101TransferLearningEarlyStopping.cs (1)
260using (HttpClient client = new HttpClient())
docs\samples\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.Tokenizers.Data.Tests (1)
test\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 });
836 references to HttpClient
aspire (21)
Commands\ExportCommand.cs (3)
122using var client = isDashboardAvailable ? TelemetryCommandHelpers.CreateApiClient(_httpClientFactory, apiToken!) : null; 256HttpClient client, 287HttpClient client,
Commands\TelemetryCommandHelpers.cs (3)
155public static HttpClient CreateApiClient(IHttpClientFactory factory, string apiToken) 157var client = factory.CreateClient(); 206public static async Task<ResourceInfoJson[]> GetAllResourcesAsync(HttpClient client, string baseUrl, CancellationToken cancellationToken)
Commands\TelemetryLogsCommand.cs (3)
116using var client = TelemetryCommandHelpers.CreateApiClient(_httpClientFactory, apiToken); 168private async Task<int> GetLogsSnapshotAsync(HttpClient client, string url, OutputFormat format, IReadOnlyList<IOtlpResource> allResources, CancellationToken cancellationToken) 194private async Task<int> StreamLogsAsync(HttpClient client, string url, OutputFormat format, IReadOnlyList<IOtlpResource> allResources, CancellationToken cancellationToken)
Commands\TelemetrySpansCommand.cs (3)
112using var client = TelemetryCommandHelpers.CreateApiClient(_httpClientFactory, apiToken); 169private async Task<int> GetSpansSnapshotAsync(HttpClient client, string url, OutputFormat format, IReadOnlyList<IOtlpResource> allResources, CancellationToken cancellationToken) 195private async Task<int> StreamSpansAsync(HttpClient client, string url, OutputFormat format, IReadOnlyList<IOtlpResource> allResources, CancellationToken cancellationToken)
Commands\TelemetryTracesCommand.cs (2)
112using var client = TelemetryCommandHelpers.CreateApiClient(_httpClientFactory, apiToken); 174using var client = TelemetryCommandHelpers.CreateApiClient(_httpClientFactory, apiToken);
Mcp\Docs\DocsFetcher.cs (2)
27internal sealed class DocsFetcher(HttpClient httpClient, IDocsCache cache, ILogger<DocsFetcher> logger) : IDocsFetcher 31private readonly HttpClient _httpClient = httpClient;
Mcp\Tools\ListStructuredLogsTool.cs (1)
58using var client = TelemetryCommandHelpers.CreateApiClient(httpClientFactory, apiToken);
Mcp\Tools\ListTracesTool.cs (1)
58using var client = TelemetryCommandHelpers.CreateApiClient(httpClientFactory, apiToken);
Mcp\Tools\ListTraceStructuredLogsTool.cs (1)
68using var client = TelemetryCommandHelpers.CreateApiClient(httpClientFactory, apiToken);
Npm\SigstoreNpmProvenanceChecker.cs (1)
16internal sealed class SigstoreNpmProvenanceChecker(HttpClient httpClient, ILogger<SigstoreNpmProvenanceChecker> logger) : INpmProvenanceChecker
Utils\CliDownloader.cs (1)
29private static readonly HttpClient s_httpClient = new();
Aspire.Cli.Tests (18)
Mcp\Docs\DocsFetcherTests.cs (16)
30using var httpClient = new HttpClient(handler); 50using var httpClient = new HttpClient(handler); 71using var httpClient = new HttpClient(handler); 98using var httpClient = new HttpClient(handler); 120using var httpClient = new HttpClient(handler); 155using var httpClient = new HttpClient(handler); 173using var httpClient = new HttpClient(handler); 186using var httpClient = new HttpClient(handler); 200using var httpClient = new HttpClient(handler); 222using var httpClient = new HttpClient(handler); 242using var httpClient = new HttpClient(handler); 261using var httpClient = new HttpClient(handler); 284using var httpClient = new HttpClient(handler); 305using var httpClient = new HttpClient(handler); 325using var httpClient = new HttpClient(handler); 358using 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 (12)
Model\Assistant\ChatClientFactory.cs (2)
32private HttpClient? _httpClient; 194private void InitializeClientConfiguration(out Uri endpoint, out string credential, out HttpClient httpClient)
Model\DebugSessionHelpers.cs (2)
13public static HttpClient CreateHttpClient(Uri? debugSessionUri, string? token, X509Certificate2? cert, Func<HttpClientHandler, HttpMessageHandler>? createHandler) 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)) 162public void QueueRequest(OperationContext context, Func<HttpClient, Func<OperationContextProperty, object>, Task> requestFunc)
Telemetry\DashboardTelemetryService.cs (1)
355private static async Task<TResponse> PostRequestAsync<TRequest, TResponse>(HttpClient client, string endpoint, TRequest request)
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 (75)
Integration\FrontendBrowserTokenAuthTests.cs (5)
39using var client = new HttpClient { BaseAddress = new Uri($"http://{app.FrontendSingleEndPointAccessor().EndPoint}") }; 61using var client = new HttpClient { BaseAddress = new Uri($"http://{app.FrontendSingleEndPointAccessor().EndPoint}") }; 92using var client = new HttpClient { BaseAddress = new Uri($"http://{app.OtlpServiceHttpEndPointAccessor().EndPoint}") }; 116using var client = new HttpClient { BaseAddress = new Uri($"http://{app.FrontendSingleEndPointAccessor().EndPoint}") }; 141using 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 (1)
27using var client = new HttpClient(httpClientHandler) { BaseAddress = new Uri(basePath) };
Integration\IntegrationTestHelpers.cs (1)
114public static HttpClient CreateHttpClient(
Integration\McpServiceTests.cs (10)
33using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.McpEndPointAccessor().EndPoint}"); 61using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.McpEndPointAccessor().EndPoint}"); 84using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.McpEndPointAccessor().EndPoint}"); 107using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.McpEndPointAccessor().EndPoint}"); 135using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.McpEndPointAccessor().EndPoint}"); 172using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.McpEndPointAccessor().EndPoint}"); 205using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.FrontendSingleEndPointAccessor().EndPoint}"); 233using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.McpEndPointAccessor().EndPoint}"); 271using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.McpEndPointAccessor().EndPoint}"); 341internal static async Task<string> InitializeSessionAsync(HttpClient httpClient, Action<HttpRequestMessage>? configureRequest = null)
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\OtlpHttpJsonTests.cs (8)
409using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.OtlpServiceHttpEndPointAccessor().EndPoint}"); 470using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.OtlpServiceHttpEndPointAccessor().EndPoint}"); 547using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.OtlpServiceHttpEndPointAccessor().EndPoint}"); 597using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.OtlpServiceHttpEndPointAccessor().EndPoint}"); 654using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.OtlpServiceHttpEndPointAccessor().EndPoint}"); 682using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.OtlpServiceHttpEndPointAccessor().EndPoint}"); 700using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.OtlpServiceHttpEndPointAccessor().EndPoint}"); 718using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.OtlpServiceHttpEndPointAccessor().EndPoint}");
Integration\OtlpHttpServiceTests.cs (12)
42using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.OtlpServiceHttpEndPointAccessor().EndPoint}"); 68using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.OtlpServiceHttpEndPointAccessor().EndPoint}"); 114using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.OtlpServiceHttpEndPointAccessor().EndPoint}"); 138using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.OtlpServiceHttpEndPointAccessor().EndPoint}"); 166using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.OtlpServiceHttpEndPointAccessor().EndPoint}"); 200using var httpClient = IntegrationTestHelpers.CreateHttpClient($"https://{app.FrontendSingleEndPointAccessor().EndPoint}", 231using var client = new HttpClient { BaseAddress = new Uri($"http://{endpoint.EndPoint}") }; 262using var client = new HttpClient { BaseAddress = new Uri($"http://{endpoint.EndPoint}") }; 309using var client = new HttpClient { BaseAddress = new Uri($"http://{endpoint.EndPoint}") }; 334using var client = new HttpClient { BaseAddress = new Uri($"http://{endpoint.EndPoint}") }; 363using var client = new HttpClient { BaseAddress = new Uri($"http://{endpoint.EndPoint}") }; 392using var client = new HttpClient { BaseAddress = new Uri($"http://{endpoint.EndPoint}") };
Integration\ResponseCompressionTests.cs (2)
22using var client = new HttpClient(httpClientHandler) { BaseAddress = new Uri($"http://{app.FrontendSingleEndPointAccessor().EndPoint}") }; 44using var client = new HttpClient(httpClientHandler) { BaseAddress = new Uri($"http://{app.FrontendSingleEndPointAccessor().EndPoint}") };
Integration\StartupTests.cs (7)
332using var httpClient = new HttpClient(new HttpClientHandler 388using var browserHttpClient = new HttpClient(new HttpClientHandler 409using var mcpHttpClient = new HttpClient(new HttpClientHandler 519using var httpClient = new HttpClient() 828using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.FrontendSingleEndPointAccessor().EndPoint}"); 984using var client = new HttpClient { BaseAddress = new Uri($"http://{app.FrontendSingleEndPointAccessor().EndPoint}") }; 1061using var client = new HttpClient { BaseAddress = new Uri($"http://{endpointString}") };
Integration\TelemetryApiTests.cs (21)
102using var httpClient = new HttpClient(handler) { BaseAddress = new Uri($"http://{app.FrontendSingleEndPointAccessor().EndPoint}") }; 122using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.FrontendSingleEndPointAccessor().EndPoint}"); 147using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.FrontendSingleEndPointAccessor().EndPoint}"); 174using var httpClient = new HttpClient(handler) { BaseAddress = new Uri($"http://{app.FrontendSingleEndPointAccessor().EndPoint}") }; 194using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.FrontendSingleEndPointAccessor().EndPoint}"); 216using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.FrontendSingleEndPointAccessor().EndPoint}"); 238using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.FrontendSingleEndPointAccessor().EndPoint}"); 259using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.FrontendSingleEndPointAccessor().EndPoint}"); 278using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.FrontendSingleEndPointAccessor().EndPoint}"); 299using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.FrontendSingleEndPointAccessor().EndPoint}"); 319using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.FrontendSingleEndPointAccessor().EndPoint}"); 343using var httpClient = new HttpClient(handler) { BaseAddress = new Uri($"http://{app.FrontendSingleEndPointAccessor().EndPoint}") }; 368using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.FrontendSingleEndPointAccessor().EndPoint}"); 392using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.FrontendSingleEndPointAccessor().EndPoint}"); 412using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.FrontendSingleEndPointAccessor().EndPoint}"); 443using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.FrontendSingleEndPointAccessor().EndPoint}"); 476using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.FrontendSingleEndPointAccessor().EndPoint}"); 498using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.FrontendSingleEndPointAccessor().EndPoint}"); 520using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.FrontendSingleEndPointAccessor().EndPoint}"); 539using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.FrontendSingleEndPointAccessor().EndPoint}"); 561using var httpClient = IntegrationTestHelpers.CreateHttpClient($"http://{app.FrontendSingleEndPointAccessor().EndPoint}");
Telemetry\DashboardTelemetrySenderTests.cs (1)
122Assert.True(telemetrySender.TryCreateHttpClient(out var client));
tests\Shared\TestDashboardTelemetrySender.cs (1)
21public void QueueRequest(OperationContext context, Func<HttpClient, Func<OperationContextProperty, object>, Task> requestFunc)
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 (12)
ApplicationModel\HttpCommandContext.cs (2)
36public required HttpClient HttpClient { get; init; } 74public required HttpClient HttpClient { get; init; }
Backchannel\AuxiliaryBackchannelRpcTarget.cs (1)
903var httpClient = httpClientFactory?.CreateClient() ?? new HttpClient();
ExternalServiceBuilderExtensions.cs (2)
260private readonly Func<HttpClient> _httpClientFactory; 266public ParameterUriHealthCheck(ParameterResource urlParameter, string? path, int expectedStatusCode, Func<HttpClient> httpClientFactory)
ResourceBuilderExtensions.cs (7)
2305/// 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"/> 2307/// If <see cref="HttpCommandOptions.HttpClientName"/> is not specified, the default <see cref="HttpClient"/> will be used. 2397/// 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"/> 2399/// If no <see cref="HttpCommandOptions.HttpClientName"/> is specified, the default <see cref="HttpClient"/> will be used. 2469var httpClient = context.ServiceProvider.GetRequiredService<IHttpClientFactory>().CreateClient(commandOptions.HttpClientName ?? Options.DefaultName);
Aspire.Hosting.Azure (1)
AcrLoginService.cs (1)
90var httpClient = _httpClientFactory.CreateClient("AcrLogin");
Aspire.Hosting.Containers.Tests (6)
WithDockerfileTests.cs (6)
43using var client = app.CreateHttpClient("testcontainer", "http"); 74using var client = app.CreateHttpClient("testcontainer", "http"); 203using var client = app.CreateHttpClient("testcontainer", "http"); 236using var client = app.CreateHttpClient("testcontainer", "http"); 463using var client = app.CreateHttpClient("testcontainer", "http"); 533using var client = app.CreateHttpClient("testcontainer", "http");
Aspire.Hosting.GitHub.Models (2)
GitHubModelsExtensions.cs (1)
213var httpClient = sp.GetRequiredService<IHttpClientFactory>().CreateClient("GitHubModelsHealthCheck");
GitHubModelsHealthCheck.cs (1)
17internal sealed class GitHubModelsHealthCheck(HttpClient httpClient, Func<ValueTask<string?>> connectionString) : IHealthCheck
Aspire.Hosting.JavaScript.Tests (3)
NodeAppFixture.cs (1)
109using var client = App.CreateHttpClient(NodeAppBuilder!.Resource.Name, endpointName: "http");
NodeFunctionalTests.cs (2)
25using var nodeClient = _nodeJsFixture.App.CreateHttpClient(_nodeJsFixture.NodeAppBuilder!.Resource.Name, "http"); 37using var npmClient = _nodeJsFixture.App.CreateHttpClient(_nodeJsFixture.NpmAppBuilder!.Resource.Name, "http");
Aspire.Hosting.OpenAI (3)
OpenAIExtensions.cs (1)
225var 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)
88var client = app.CreateHttpClient(adminBuilder.Resource.Name, "http"); 165var client = app.CreateHttpClient(pgWebBuilder.Resource.Name, "http");
Aspire.Hosting.Redis.Tests (7)
RedisFunctionalTests.cs (7)
82var client = app.CreateHttpClient(commanderBuilder.Resource.Name, "http"); 154var client = app.CreateHttpClient(redisInsightBuilder.Resource.Name, "http"); 493var httpClient = app.CreateHttpClient(redisInsightBuilder1.Resource.Name, "http"); 528var httpClient = app.CreateHttpClient(redisInsightBuilder2.Resource.Name, "http"); 559private static async Task EnsureRedisInsightEulaAccepted(HttpClient httpClient, CancellationToken ct) 584static async Task AcceptRedisInsightEula(HttpClient client, CancellationToken ct) 635var client = clientFactory.CreateClient();
Aspire.Hosting.Seq.Tests (6)
SeqFunctionalTests.cs (6)
32var client = CreateClient(seqUrl); 40private static HttpClient CreateClient(string url) 42HttpClient client = new() 49private static async Task CreateTestDataAsync(HttpClient httpClient, CancellationToken token) 112var client = CreateClient(seqUrl); 151var client = CreateClient(seqUrl);
Aspire.Hosting.Testing (7)
DistributedApplicationFactory.cs (3)
78/// Creates an instance of <see cref="HttpClient"/> that is configured to route requests to the specified resource and endpoint. 80/// <returns>The <see cref="HttpClient"/>.</returns> 81public HttpClient CreateHttpClient(string resourceName, string? endpointName = default)
DistributedApplicationHostingTestingExtensions.cs (4)
16/// Creates an <see cref="HttpClient"/> configured to communicate with the specified resource. 22/// <returns>The <see cref="HttpClient"/>.</returns> 24public static HttpClient CreateHttpClient(this DistributedApplication app, string resourceName, string? endpointName = default) 31var client = clientFactory.CreateClient();
Aspire.Hosting.Testing.Tests (10)
DistributedApplicationHttpClientExtensionsForTests.cs (2)
12public static HttpClient CreateHttpClientWithResilience(this DistributedApplication app, string resourceName, string? endpointName = default, Action<HttpStandardResilienceOptions>? configure = default) 15HttpClient client;
TestingBuilderTests.cs (6)
188var httpClient = app.CreateHttpClientWithResilience("mywebapp1", null, opts => 248var httpClient = app.CreateHttpClientWithResilience("mywebapp1", null, opts => 287var httpClient = app.CreateHttpClientWithResilience("mywebapp1", null, opts => 331var httpClient = app.CreateHttpClientWithResilience("mywebapp1", null, opts => 382var httpClient = app.CreateHttpClientWithResilience("mywebapp1", null, opts => 433var httpClient = app.CreateHttpClientWithResilience("mywebapp1", "https", opts =>
TestingFactoryTests.cs (2)
54var httpClient = _app.CreateHttpClientWithResilience("mywebapp1"); 82var httpClient = _app.CreateHttpClientWithResilience("mywebapp1", "https");
Aspire.Hosting.Tests (19)
ContainerTunnelTests.cs (2)
37using var clientA = app.CreateHttpClient(yarp.Resource.Name, "http"); 77using var clientA = app.CreateHttpClient(yarp.Resource.Name, "http");
DistributedApplicationTests.cs (9)
636using var clientA = app.CreateHttpClient(testProgram.ServiceABuilder.Resource.Name, "http"); 637using var clientC = app.CreateHttpClient(testProgram.ServiceCBuilder.Resource.Name, "http"); 649using var clientB = new HttpClient(); 1517var client = app.CreateHttpClientWithResilience($"{testName}-servicea", "http"); 1525using var client2 = new HttpClient(new SocketsHttpHandler 1572using var client = new HttpClient(); 1592using var client = new HttpClient(); 1635using var clientA = app.CreateHttpClient(servicea.Resource.Name, "http"); 1704using 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;
Aspire.Hosting.Yarp.Tests (1)
YarpFunctionalTests.cs (1)
52using var httpClient = app.CreateHttpClient(yarp.Resource.Name);
Aspire.Playground.Tests (13)
AppHostTests.cs (2)
95using var client = CreateHttpClientWithResilience(app, resource); 117public static HttpClient CreateHttpClientWithResilience(DistributedApplication app, string resource)
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)
14readonly 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 (2)
Commands\Workload\Install\WorkloadManifestUpdater.cs (1)
505using HttpClient httpClient = new();
NugetSearch\NugetToolSearchApiRequest.cs (1)
23var httpClient = new HttpClient();
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);
GenerateDocumentationAndConfigFiles (1)
Program.cs (1)
33private static readonly HttpClient httpClient = new();
Infrastructure.Common (3)
ServiceUtilHelper.cs (3)
574using (HttpClient httpClient = new HttpClient()) 593using (HttpClient httpClient = new HttpClient()) 612using (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.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.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.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(); 150using var client = hostMock.Object.CreateClient(null, x => x.AbsoluteUri == _urlAddresses[1]); 162using var client = host.CreateClient(); 174using var client = host.CreateClient();
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)
152using (var httpClient = new HttpClient(handler)) 172private async Tasks.Task<bool> DownloadWithRetriesAsync(HttpClient httpClient, string uri)
Microsoft.DotNet.HotReload.WebAssembly.Browser (1)
WebAssemblyHotReload.cs (1)
89using var client = new HttpClient()
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 (114)
OpenAIAssistantChatClientIntegrationTests.cs (1)
107using HttpClient client = new(new HttpClientHandler
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); 1222using HttpClient httpClient = new(handler); 1321using HttpClient httpClient = new(handler); 1461using HttpClient httpClient = new(handler); 1581using HttpClient httpClient = new(handler); 1628using HttpClient httpClient = new(handler); 1676using HttpClient httpClient = new(handler); 1722using HttpClient httpClient = new(handler); 1740private static IChatClient CreateChatClient(HttpClient httpClient, string modelId) => 1861using HttpClient httpClient = new(handler); 1906using HttpClient httpClient = new(handler); 1956using HttpClient httpClient = new(handler); 2013using 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) =>
OpenAIResponseClientTests.cs (75)
150using HttpClient httpClient = new(handler); 293using HttpClient httpClient = new(handler); 426using HttpClient httpClient = new(handler); 552using HttpClient httpClient = new(handler); 657using HttpClient httpClient = new(handler); 797using HttpClient httpClient = new(handler); 890using HttpClient httpClient = new(handler); 996using HttpClient httpClient = new(handler); 1141using HttpClient httpClient = new(handler); 1269using HttpClient httpClient = new(handler); 1403using (HttpClient httpClient = new(handler)) 1524using (HttpClient httpClient = new(handler)) 1769using HttpClient httpClient = new(handler); 2184using HttpClient httpClient = new(handler); 2307using HttpClient httpClient = new(handler); 2379using HttpClient httpClient = new(handler); 2468using HttpClient httpClient = new(handler); 2520using HttpClient httpClient = new(handler); 2615using HttpClient httpClient = new(handler); 2696using HttpClient httpClient = new(handler); 2763using HttpClient httpClient = new(handler); 2887using HttpClient httpClient = new(handler); 3107using HttpClient httpClient = new(handler); 3194using HttpClient httpClient = new(handler); 3263using HttpClient httpClient = new(handler); 3315using HttpClient httpClient = new(handler); 3373using HttpClient httpClient = new(handler); 3432using HttpClient httpClient = new(handler); 3493using HttpClient httpClient = new(handler); 3555using HttpClient httpClient = new(handler); 3618using HttpClient httpClient = new(handler); 3691using HttpClient httpClient = new(handler); 3772using HttpClient httpClient = new(handler); 3853using HttpClient httpClient = new(handler); 3931using HttpClient httpClient = new(handler); 3997using HttpClient httpClient = new(handler); 4058using HttpClient httpClient = new(handler); 4128using HttpClient httpClient = new(handler); 4187using HttpClient httpClient = new(handler); 4243using HttpClient httpClient = new(handler); 4304using HttpClient httpClient = new(handler); 4362using HttpClient httpClient = new(handler); 4419using HttpClient httpClient = new(handler); 4478using HttpClient httpClient = new(handler); 4540using HttpClient httpClient = new(handler); 4596using HttpClient httpClient = new(handler); 4651using HttpClient httpClient = new(handler); 4708using HttpClient httpClient = new(handler); 4765using HttpClient httpClient = new(handler); 4802using HttpClient httpClient = new(handler); 4834using HttpClient httpClient = new(handler); 4878using HttpClient httpClient = new(handler); 4929using HttpClient httpClient = new(handler); 4975using HttpClient httpClient = new(handler); 5010using HttpClient httpClient = new(handler); 5045using HttpClient httpClient = new(handler); 5080using HttpClient httpClient = new(handler); 5118using HttpClient httpClient = new(handler); 5156using HttpClient httpClient = new(handler); 5176using HttpClient httpClient = new(); 5214using HttpClient httpClient = new(handler); 5257using HttpClient httpClient = new(handler); 5300using HttpClient httpClient = new(handler); 5343using HttpClient httpClient = new(handler); 5418using HttpClient httpClient = new(handler); 5490using HttpClient httpClient = new(handler); 5531using HttpClient httpClient = new(handler); 5585using HttpClient httpClient = new(handler); 5648using HttpClient httpClient = new(handler); 5721using HttpClient httpClient = new(handler); 5821using HttpClient httpClient = new(handler); 5938using HttpClient httpClient = new(handler); 6068using HttpClient httpClient = new(handler); 6122using HttpClient httpClient = new(handler); 6146private static IChatClient CreateResponseClient(HttpClient httpClient, string modelId) =>
OpenAISpeechToTextClientTests.cs (8)
83using HttpClient httpClient = new(handler); 104using HttpClient httpClient = new(); 118using HttpClient httpClient = new(); 158using HttpClient httpClient = new(handler); 193using HttpClient httpClient = new(handler); 230using HttpClient httpClient = new(handler); 267using HttpClient httpClient = new(handler); 288private static ISpeechToTextClient CreateSpeechToTextClient(HttpClient httpClient, string modelId) =>
Microsoft.Extensions.DataIngestion.Tests (1)
Readers\DocumentReaderConformanceTests.cs (1)
18private 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 (41)
Latency\HttpClientLatencyTelemetryExtensionsTest.cs (1)
66using var httpClient = sp.GetRequiredService<IHttpClientFactory>().CreateClient();
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 (14)
70using var client = new HttpClient(handler); 105using var client = new HttpClient(handler); 148using var httpClient = new HttpClient(handler); 237using var client = new HttpClient(handler); 334using var client = new HttpClient(handler); 438using var client = new HttpClient(handler); 554using var client = new HttpClient(handler); 648using var client = new HttpClient(handler); 692using var client = new HttpClient(handler); 735using var client = new HttpClient(handler); 773using var client = new HttpClient(handler); 817using var client = new HttpClient(handler); 923using var client = new HttpClient(handler); 964using var client = new HttpClient(handler);
Logging\HttpClientLoggingExtensionsTest.cs (6)
308using var httpClient = provider.GetRequiredService<IHttpClientFactory>().CreateClient(); 391using var httpClient = provider.GetRequiredService<IHttpClientFactory>().CreateClient(); 404using var httpClient = sp.GetRequiredService<IHttpClientFactory>().CreateClient(); 427var client = sp.GetRequiredService<IHttpClientFactory>().CreateClient("test"); 477var outerClient = factory.CreateClient("outer"); 486var 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.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.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)
docs\samples\Microsoft.ML.Samples\Dynamic\TensorFlow\ImageClassification.cs (1)
123using (HttpClient client = new HttpClient())
docs\samples\Microsoft.ML.Samples\Dynamic\Trainers\MulticlassClassification\ImageClassification\ImageClassificationDefault.cs (1)
272using (HttpClient client = new HttpClient())
docs\samples\Microsoft.ML.Samples\Dynamic\Trainers\MulticlassClassification\ImageClassification\LearningRateSchedulingCifarResnetTransferLearning.cs (1)
304using (HttpClient client = new HttpClient())
docs\samples\Microsoft.ML.Samples\Dynamic\Trainers\MulticlassClassification\ImageClassification\ResnetV2101TransferLearningEarlyStopping.cs (1)
260using (HttpClient client = new HttpClient())
docs\samples\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.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)
test\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) };
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)
Stress.ApiService (1)
Program.cs (1)
151app.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)
134_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");