/// <summary> /// Initializes a new instance of the <see cref="HttpClientWrapper"/> class. /// </summary> /// <param name="authenticationKey"> /// The authentication Key. /// </param> public HttpClientWrapper(string authenticationKey) { this.httpClient = HttpClientFactory.Create(); this.httpClient.DefaultRequestHeaders.ExpectContinue = false; this.retryPolicy = GetDefaultRetryPolicy(); this.authenticationKey = authenticationKey; this.exceptionHandlingHelper = new ExceptionHandlingHelper(); }
/// <summary> /// Initializes a new instance of the <see cref="HttpClientWrapper"/> class. /// </summary> /// <param name="defaultHeaders">The default headers.</param> /// <param name="authenticationKey">The authentication key.</param> /// <param name="timeout">The timeout.</param> public HttpClientWrapper(IDictionary <string, string> defaultHeaders, string authenticationKey, TimeSpan timeout) { this.httpClient = HttpClientFactory.Create(); this.httpClient.Timeout = timeout; this.httpClient.DefaultRequestHeaders.ExpectContinue = false; AddDefaultHeaders(this.httpClient, defaultHeaders); this.retryPolicy = GetDefaultRetryPolicy(); this.authenticationKey = authenticationKey; this.exceptionHandlingHelper = new ExceptionHandlingHelper(); }
/// <summary> /// Initializes a new instance of the <see cref="HttpClientWrapper"/> class. /// </summary> /// <param name="baseAddress">The base address.</param> /// <param name="defaultHeaders">The default headers.</param> /// <param name="authenticationKey">The authentication key.</param> /// <param name="retryPolicy">The retry policy.</param> /// <param name="customHttpStatusCodes">The custom http status codes for which mappings are created.</param> public HttpClientWrapper(Uri baseAddress, IDictionary <string, string> defaultHeaders, string authenticationKey, RetryPolicy retryPolicy, List <HttpStatusCode> customHttpStatusCodes) { this.httpClient = HttpClientFactory.Create(); this.httpClient.BaseAddress = baseAddress; this.httpClient.DefaultRequestHeaders.ExpectContinue = false; AddDefaultHeaders(this.httpClient, defaultHeaders); this.retryPolicy = retryPolicy ?? GetDefaultRetryPolicy(); this.authenticationKey = authenticationKey; this.exceptionHandlingHelper = new ExceptionHandlingHelper(customHttpStatusCodes); }