Skip to content

Commit

Permalink
HttpClientHandler has been deprecated and replaced SocketsHttpHandler (
Browse files Browse the repository at this point in the history
…#1039)

Signed-off-by: scottxu <[email protected]>
  • Loading branch information
iamscottxu authored Aug 18, 2024
1 parent 1b22d92 commit 893cd59
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Starward/AppConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,9 @@ private static void BuildServiceProvider()
sc.AddLogging(c => c.AddSerilog(Log.Logger));
sc.AddTransient(_ =>
{
var client = new HttpClient(new HttpClientHandler { AutomaticDecompression = DecompressionMethods.All }) { DefaultRequestVersion = HttpVersion.Version20 };
//See: https://learn.microsoft.com/zh-cn/dotnet/fundamentals/runtime-libraries/system-net-http-httpclienthandler
//See: https://learn.microsoft.com/zh-cn/dotnet/api/system.net.http.socketshttphandler?view=net-8.0
var client = new HttpClient(new SocketsHttpHandler { AutomaticDecompression = DecompressionMethods.All }) { DefaultRequestVersion = HttpVersion.Version20 };
client.DefaultRequestHeaders.Add("User-Agent", $"Starward/{AppVersion}");
return client;
});
Expand Down

0 comments on commit 893cd59

Please sign in to comment.