Ejemplo n.º 1
0
 private static HttpClientRegistrator ConfigureBaseClient(WebapiEndpoint endpoint)
 {
     return(HttpClientRegistrator.Create()
            .WithName(endpoint.Name)
            .WithUrl(endpoint.Url)
            .WithTimeout(endpoint.Timeout)
            .WithHandler <BaseCompanyRequestHeadersHandler>());
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Создаёт и конфигурирует Http-клиенты
 /// </summary>
 private static HttpClientRegistrator ConfigureClient(WebapiEndpoint endpoint)
 {
     return(HttpClientRegistrator.Create()
            .WithName(endpoint.Name)
            .WithUrl(endpoint.Url)
            .WithTimeout(endpoint.Timeout)
            .WithHandler <BaseCompanyRequestHeadersHandler>()
            .ConfigureBuilder(x => x.ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler
     {
         AllowAutoRedirect = false,
         UseProxy = false
     })));
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Создаёт и конфигурирует Http-клиенты
 /// </summary>
 private static HttpClientRegistrator ConfigureClient(BasicWebApiEndPoint endpoint)
 {
     return(HttpClientRegistrator.Create()
            .WithName(endpoint.Name)
            .WithUrl(endpoint.Url)
            .WithTimeout(endpoint.Timeout)
            .WithHandler(() => new BasicHttpClientAuthorizationRequestHandler(endpoint.UserName, endpoint.Password))
            .WithHandler <BaseCompanyRequestHeadersHandler>()
            .ConfigureBuilder(x => x.ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler
     {
         AllowAutoRedirect = false,
         UseProxy = false,
         MaxConnectionsPerServer = endpoint.MaxConnections ?? int.MaxValue
     })));
 }