Tools.HttpClientFactory 1.0.2

dotnet add package Tools.HttpClientFactory --version 1.0.2
NuGet\Install-Package Tools.HttpClientFactory -Version 1.0.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Tools.HttpClientFactory" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Tools.HttpClientFactory --version 1.0.2
#r "nuget: Tools.HttpClientFactory, 1.0.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Tools.HttpClientFactory as a Cake Addin
#addin nuget:?package=Tools.HttpClientFactory&version=1.0.2

// Install Tools.HttpClientFactory as a Cake Tool
#tool nuget:?package=Tools.HttpClientFactory&version=1.0.2

HttpClientFactory

This component is an extension to IHttpClientFactory. This allows you to use HttpClientFactory outside of dependency injection.
Through named HttpClients, you can re-use clients across your app. Learn more about why you should use HttpClientFactory here

NOTE: HttpClientFactory is under System.Net.Http after installing this package.

Usage

Using HttpClientFactory is simple. There are three ways to generate HttpClients.

Anonymous HttpClient

HttpClient httpClient = HttpClientFactory.CreateClient();

Named HttpClient

HttpClient namedHttpClient = HttpClientFactory.CreateClient("test");

Named HttpClient with SocketsHttpHandler

HttpClient namedHttpClient = HttpClientFactory.CreateClient("test", new SocketsHttpHandler
{
    // Properties
});
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.2 180 11/3/2023
1.0.1 86 11/3/2023
1.0.0 104 11/2/2023

Added a "SocketsHttpHandler" overload to CreateClient