I want to use the HttpClientFactory
that is available in .NET Core 2.1 but I also want to use the HttpClientHandler
to utilize the AutomaticD
Actually I'm not using automatic decompression but the way to achieve this is to properly register http client
services.AddHttpClient()
.ConfigureHttpMessageHandlerBuilder((c) =>
new HttpClientHandler()
{
AutomaticDecompression = System.Net.DecompressionMethods.GZip
}
)
.AddHttpMessageHandler((s) => s.GetService())