From f8dd16454f420f29cbdfb055964242a96df11b7c Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Fri, 5 Dec 2025 23:24:44 +0100 Subject: [PATCH] Add AddRecClient method and conditional using directive Added a `using System.Net.Http;` directive within a `#if NETFRAMEWORK` block in `DependencyInjection.cs` to ensure compatibility with .NET Framework. Introduced the `AddRecClient` extension method in the `DependencyInjection` class to enable custom configuration of `HttpClient` instances via an `Action` delegate. --- src/ReC.Client/DependencyInjection.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ReC.Client/DependencyInjection.cs b/src/ReC.Client/DependencyInjection.cs index 8e12a67..1b9c122 100644 --- a/src/ReC.Client/DependencyInjection.cs +++ b/src/ReC.Client/DependencyInjection.cs @@ -1,6 +1,7 @@ using Microsoft.Extensions.DependencyInjection; #if NETFRAMEWORK using System; +using System.Net.Http; #endif namespace ReC.Client @@ -14,5 +15,10 @@ namespace ReC.Client client.BaseAddress = new Uri(apiUri); }); } + + public static IHttpClientBuilder AddRecClient(this IServiceCollection services, Action configureClient) + { + return services.AddHttpClient(ReCClient.ClientName, configureClient); + } } -} +} \ No newline at end of file