예제 #1
0
            private static NonDisposableHttpClient CreateLazyClient(TimeSpan connectionLifetime, params DelegatingHandler[] delegatingHandlers)
            {
                ServicePointHttpMessageHandler handler =
                    new ServicePointHttpMessageHandler(
                        connectionLifetime,
                        new HttpClientHandler());

                return(new NonDisposableHttpClient(
                           CreateHandlerPipeline(
                               handler,
                               delegatingHandlers)));
            }
            private static NonDisposableHttpClient CreateLazyClient(
                TimeSpan connectionLifetime,
                params DelegatingHandler[] delegatingHandlers)
            {
#pragma warning disable CA2000 // Dispose objects before losing scope
                // This handler object is disposed by the HttpClient instance
                // when the DotNetStandardHttpClientFactory is disposed.
                ServicePointHttpMessageHandler handler =
                    new ServicePointHttpMessageHandler(
                        connectionLifetime,
                        new HttpClientHandler());
#pragma warning restore CA2000 // Dispose objects before losing scope

                return(new NonDisposableHttpClient(
                           CreateHandlerPipeline(
                               handler,
                               delegatingHandlers)));
            }