private IHttpClient GetHttpClient(string cacheKey, IHttpClientBuilder builder, bool useCookieContainer, bool allowAutoRedirect)
        {
            var httpClient = _cacheHandlers.Get(cacheKey);

            if (httpClient == null)
            {
                httpClient = builder.Create(useCookieContainer, allowAutoRedirect);
            }
            return(httpClient);
        }
示例#2
0
        private IHttpClient GetHttpClient(string cacheKey, IHttpClientBuilder builder)
        {
            var httpClient = _cacheHandlers.Get(cacheKey);

            if (httpClient == null)
            {
                httpClient = builder.Create();
            }
            return(httpClient);
        }
        private IHttpClient GetHttpClient(string cacheKey, IHttpClientBuilder builder, DownstreamContext request)
        {
            var httpClient = _cacheHandlers.Get(cacheKey);

            if (httpClient == null)
            {
                httpClient = builder.Create(request.DownstreamReRoute);
            }

            return(httpClient);
        }
示例#4
0
        public async Task GetAsync(
            IRequestInfo info, CancellationToken cancellationToken = default)
        {
            using var client = httpClientBuilder.Create(info);
            var linkedToken = cancellationTokenFactory.Create(cancellationToken, info.Timeout);

            var response = await client.GetAsync(info.Url, linkedToken);

            response.EnsureSuccessStatusCode();
        }