internal HttwrapClient(IHttwrapConfiguration configuration, IQueryStringBuilder queryStringBuilder) { _configuration = configuration; _queryStringBuilder = queryStringBuilder; _httpClient = _configuration.GetHttpClient(); _interceptors = _configuration.GetInterceptors(); }
private async Task <HttpResponseMessage> RequestInnerAsync(TimeSpan?requestTimeout, HttpCompletionOption completionOption, CancellationToken cancellationToken, HttpMethod method, string path, object body) { try { var client = _configuration.GetHttpClient(); if (requestTimeout.HasValue) { client.Timeout = requestTimeout.Value; } var request = PrepareRequest(method, body, path); return(await client.SendAsync(request, completionOption, cancellationToken)); } catch (Exception ex) { throw new HttwrapException( string.Format("An error occured while execution request. Path : {0} , HttpMethod : {1}", path, method), ex); } }