Exemple #1
0
        private async Task Configure(HttpClient client, SupportedServices serviceToCall)
        {
            client.Timeout     = _timeOut;
            client.BaseAddress = _baseAddressResolver.ResolveBaseAddress(serviceToCall);
            client.DefaultRequestHeaders.Accept.Clear();
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            client.DefaultRequestHeaders.AcceptEncoding.Add(new StringWithQualityHeaderValue("gzip"));

            //var bearerToken = await _tokenCreator.RequestTokenAsync(_bioCredentials, serviceToCall);
            //client.SetBearerToken(bearerToken);
        }
Exemple #2
0
 private async Task <HttpResponseMessage> PostAsyncStringContent(
     string uriExtension, StringContent stringContent,
     SupportedServices serviceToCall)
 {
     uriExtension = UriFormatter.FormatUriAsExtension(uriExtension);
     using (var client = new HttpClient())
     {
         client.BaseAddress = _baseAddressResolver.ResolveBaseAddress(serviceToCall);
         return(await client.PostAsync(uriExtension, stringContent));
     }
 }