What is the best practice for changing the underlying HttpClient
for a IHttpClientFactory
Here is how I create my Dependency Injection:
IServiceCollection serColl = new ServiceCollection();
serColl.AddHttpClient("tester").ConfigurePrimaryHttpMessageHandler(() =>
{
return new HttpClientHandler()
{
CookieContainer = Cookies,
};
});
var serviceProvider = serColl.BuildServiceProvider();
_HTTPClientFactory = serviceProvider.GetService<IHttpClientFactory>();
In this case Cookies
holds a number of System.Net.Cookies
. My question is if I need to change the cookies how should I do this?