Beispiel #1
0
        public static HttpClientHandler CreateHttpClientHandler()
        {
            var handler = new HttpClientHandler();

            handler.ApplyProxy();

            return(handler);
        }
Beispiel #2
0
        private HttpClient CreateClient(IBoxRequest request)
        {
            HttpClientHandler handler = new HttpClientHandler()
            {
                AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip
            };

            handler.AllowAutoRedirect = request.FollowRedirect;
            handler.ApplyProxy();

            HttpClient client = new HttpClient(handler);

            if (request.Timeout.HasValue)
            {
                client.Timeout = request.Timeout.Value;
            }

            return(client);
        }