private static HttpClientRegistrator ConfigureBaseClient(WebapiEndpoint endpoint) { return(HttpClientRegistrator.Create() .WithName(endpoint.Name) .WithUrl(endpoint.Url) .WithTimeout(endpoint.Timeout) .WithHandler <BaseCompanyRequestHeadersHandler>()); }
/// <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 }))); }
/// <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 }))); }