private async Task <HttpResponseMessage> SendAsync(HttpMethod method, Func <Urls, string> relativePathSelector, string mediaType, bool cache, HttpContent content = null, bool authorize = false) { var client = await GetHttpClient(); var urls = await GetUrls(); var url = relativePathSelector(urls); using (var message = new HttpRequestMessage(method, url)) { message.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(mediaType)); if (authorize) { AuthorizationHandler.SetDoAuthrozation(message); } if (content != null) { message.Content = content; } message.Headers.CacheControl = new CacheControlHeaderValue { NoCache = !cache }; return(await client.SendAsync(message)); } }