This commit is contained in:
2026-04-17 14:55:32 -04:00
commit bc3ac1d4c9
18017 changed files with 4371742 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
using Microsoft.Extensions.DependencyInjection;
using System.Net.Http;
namespace CANFDApiProxy
{
public static class HttpClientFactory
{
private static IHttpClientFactory CreateHttpClientFactory()
{
var httpClientFactory = new ServiceCollection().AddHttpClient().BuildServiceProvider().GetRequiredService<IHttpClientFactory>();
return httpClientFactory;
}
public static HttpClient CreateHttpClient()
{
IHttpClientFactory httpClientFactory = CreateHttpClientFactory();
var httpClient = httpClientFactory.CreateClient();
httpClient.DefaultRequestHeaders.Clear();
httpClient.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
return httpClient;
}
}
}