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<HttpClient>` delegate.
This commit is contained in:
parent
8cad1df95d
commit
f8dd16454f
@ -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<HttpClient> configureClient)
|
||||
{
|
||||
return services.AddHttpClient(ReCClient.ClientName, configureClient);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user