public HttpClientWrapper(HttpClientConfiguration httpClientConfig) { this.client = new HttpClient() { Timeout = httpClientConfig.Timeout }; }
/// <summary> /// Initializes a new instance of the <see cref="HttpClientWrapper"/> class. /// </summary> public HttpClientWrapper() { HttpClientConfiguration httpClientConfig = new HttpClientConfiguration(); this.statusCodesToRetry = httpClientConfig.StatusCodesToRetry .Where(val => Enum.IsDefined(typeof(HttpStatusCode), val)) .Select(val => (HttpStatusCode)val).ToImmutableList(); this.requestMethodsToRetry = httpClientConfig.RequestMethodsToRetry .Select(method => new HttpMethod(method.ToString())).ToList(); this.numberOfRetries = httpClientConfig.NumberOfRetries; this.backoffFactor = httpClientConfig.BackoffFactor; this.retryInterval = httpClientConfig.RetryInterval; this.backoffMax = httpClientConfig.BackoffMax; this.client = this.GetDefaultHttpClient(); }