mirror of
https://github.com/Cleanuparr/Cleanuparr.git
synced 2026-01-16 17:58:22 -05:00
try fix download client factory
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Http;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace Infrastructure.Http.DynamicHttpClientSystem;
|
||||
|
||||
/// <summary>
|
||||
/// Service collection extensions for the dynamic HTTP client system
|
||||
/// </summary>
|
||||
public static class DynamicHttpClientServiceCollectionExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds the dynamic HTTP client system to the service collection
|
||||
/// This replaces the traditional AddHttpClients method
|
||||
/// </summary>
|
||||
public static IServiceCollection AddDynamicHttpClients(this IServiceCollection services)
|
||||
{
|
||||
// Register the dynamic system components
|
||||
services.AddSingleton<IHttpClientConfigStore, HttpClientConfigStore>();
|
||||
services.AddSingleton<IConfigureOptions<HttpClientFactoryOptions>, DynamicHttpClientConfiguration>();
|
||||
services.AddSingleton<IDynamicHttpClientFactory, DynamicHttpClientFactory>();
|
||||
|
||||
// Add base HttpClient factory
|
||||
services.AddHttpClient();
|
||||
|
||||
// Pre-register standard configurations using a hosted service
|
||||
services.AddHostedService<HttpClientConfigurationService>();
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user