Ejemplo n.º 1
0
        private HttpClient GetConfiguredClient(HttpClientOfOneCSettings settings)
        {
            HttpClient httpClient = new HttpClient();

            httpClient.BaseAddress = new Uri(settings.ServiceBaseAddress);
            httpClient.DefaultRequestHeaders.Accept.Clear();

            String authentificationInfo = Convert.ToBase64String(Encoding.UTF8.GetBytes($"{settings.AgentLogin}:{settings.AgentPassword}"));

            httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authentificationInfo);
            httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            return(httpClient);
        }
Ejemplo n.º 2
0
 public HttpClientOfOneC(HttpClientOfOneCSettings settings)
 {
     HttpClient = GetConfiguredClient(settings);
 }