public static Task <HttpClient> CreateAsync(this IHttpClientFactory factory, CancellationToken cancellationToken) { // Create the message handler. HttpMessageHandler handler = HttpMessageHandlerExtensions.CreateDefaultMessageHandler(); // Call the overload. return(factory.CreateAsync(handler, cancellationToken)); }
protected virtual Task <HttpClient> CreateHttpClientAsync(HttpMessageHandler httpMessageHandler, bool disposeHandler, CancellationToken cancellationToken) { // Validate parameters. if (httpMessageHandler == null) { throw new ArgumentNullException(nameof(httpMessageHandler)); } // Call the func. return(_httpClientFactory.CreateAsync(httpMessageHandler, disposeHandler, cancellationToken)); }
public static Task <HttpClient> CreateAsync(this IHttpClientFactory factory, HttpMessageHandler handler, CancellationToken cancellationToken) { // Validate parameters. if (handler == null) { throw new ArgumentNullException(nameof(handler)); } // Call the overload. return(factory.CreateAsync(handler, true, cancellationToken)); }