/// <summary> /// Constructor that instaciates the internal <see cref="HttpClient"/> with a custom /// <see cref="HttpClientHandler"/> /// </summary> /// <param name="httpClientHandler"></param> /// <exception cref="ArgumentNullException"></exception> public HttpHandler(HttpClientHandler httpClientHandler) { if (httpClientHandler.IsNull()) { throw new ArgumentNullException(nameof(httpClientHandler)); } _client = new HttpClient(httpClientHandler); }
public static HttpClient CreateHttpClient(this Public Public, HttpClientHandler handler = null) { if (UseProxy) { var proxy = Actor.Public.GetService <IHttpProxyFactory>().BuildProxy(); if (handler.IsNull()) { handler = new HttpClientHandler(); } handler.Proxy = proxy; return(new HttpClient(handler)); } else { return(handler.IsNotNull() ? new HttpClient(handler) : new HttpClient()); } }