@@ -52,10 +52,12 @@ private HttpClient CreateHttpClient(HttpClientOptions? options)
5252 {
5353 if ( RuntimeUtil . IsBrowser ( ) )
5454 {
55- return options ? . HttpClientHandler != null ? new HttpClient ( options . HttpClientHandler ) : new HttpClient ( ) ;
55+ return options ? . HttpClientHandler != null ? new HttpClient ( options . HttpClientHandler , disposeHandler : false ) : new HttpClient ( ) ;
5656 }
5757
58- return options ? . HttpClientHandler != null ? new HttpClient ( options . HttpClientHandler ) : new HttpClient ( GetOrCreateHandler ( options ) ) ;
58+ return options ? . HttpClientHandler != null
59+ ? new HttpClient ( options . HttpClientHandler , disposeHandler : false )
60+ : new HttpClient ( GetOrCreateHandler ( options ) , disposeHandler : false ) ;
5961 }
6062
6163 public ValueTask < HttpClient > Get ( string id , HttpClientOptions ? options = null , CancellationToken cancellationToken = default )
@@ -113,11 +115,8 @@ private static async ValueTask ConfigureHttpClient(HttpClient httpClient, HttpCl
113115
114116 private SocketsHttpHandler GetOrCreateHandler ( HttpClientOptions ? options )
115117 {
116- var key = new HandlerKey (
117- options ? . PooledConnectionLifetime ? . TotalSeconds ?? 600 ,
118- options ? . MaxConnectionsPerServer ?? 40 ,
119- options ? . UseCookieContainer == true
120- ) ;
118+ var key = new HandlerKey ( options ? . PooledConnectionLifetime ? . TotalSeconds ?? 600 , options ? . MaxConnectionsPerServer ?? 40 ,
119+ options ? . UseCookieContainer == true ) ;
121120
122121 return _handlers . GetOrAdd ( key , _ =>
123122 {
0 commit comments