IHttpClient 0.0.8
See the version list below for details.
dotnet add package IHttpClient --version 0.0.8
NuGet\Install-Package IHttpClient -Version 0.0.8
<PackageReference Include="IHttpClient" Version="0.0.8" />
<PackageVersion Include="IHttpClient" Version="0.0.8" />
<PackageReference Include="IHttpClient" />
paket add IHttpClient --version 0.0.8
#r "nuget: IHttpClient, 0.0.8"
#:package IHttpClient@0.0.8
#addin nuget:?package=IHttpClient&version=0.0.8
#tool nuget:?package=IHttpClient&version=0.0.8
Info
This project uses source generation to generate an IHttpClient
interface and HttpClientProxy
from the HttpClient
to make it injectable and unit-testable.
All the methods and properties from the HttpClient
are replicated to IHttpClient
.
Usage
Use it direct:
HttpClient httpClient = new HttpClient();
IHttpClient httpClientProxy = new HttpClientProxy(httpClient);
var result = await httpClientProxy.GetAsync("https://www.google.nl");
var todo = await httpClientProxy.GetFromJsonAsync<Todo>("https://jsonplaceholder.typicode.com/todos/1");
var postResult = await httpClientProxy.PostAsJsonAsync("https://jsonplaceholder.typicode.com/todos", new Todo { Id = 123 });
var patchResult = await httpClientProxy.PatchAsJsonAsync("https://jsonplaceholder.typicode.com/todos/1", new Todo { Id = 400 });
var putResult = await httpClientProxy.PutAsJsonAsync("https://jsonplaceholder.typicode.com/todos/1", new Todo { Id = 444 });
Or use the IIHttpClientFactory
to create the IHttpClient
:
IServiceCollection services = new ServiceCollection();
services.AddHttpClient();
services.AddSingleton<IIHttpClientFactory, HttpClientFactoryService>();
IHttpClient httpClientProxy = services.BuildServiceProvider()
.GetRequiredService<IIHttpClientFactory>()
.Create("MyClient");
Sponsors
Entity Framework Extensions and Dapper Plus are major sponsors and proud to contribute to the development of IHttpClient.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. 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 is compatible. 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 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
.NET Framework | net461 is compatible. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.1
- Microsoft.Extensions.Http (>= 2.1.0)
- StringSyntaxPolyfill (>= 1.1.0)
- System.Net.Http.Json (>= 6.0.0)
-
.NETStandard 2.1
- Microsoft.Extensions.Http (>= 2.1.0)
- StringSyntaxPolyfill (>= 1.1.0)
- System.Net.Http.Json (>= 6.0.0)
-
net6.0
- Microsoft.Extensions.Http (>= 6.0.0)
- StringSyntaxPolyfill (>= 1.1.0)
- System.Net.Http.Json (>= 6.0.0)
-
net7.0
- Microsoft.Extensions.Http (>= 7.0.0)
-
net8.0
- Microsoft.Extensions.Http (>= 8.0.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on IHttpClient:
Package | Downloads |
---|---|
Blazor.BrowserExtension.Authentication.Microsoft
This package adds Microsoft Authentication to a Blazor.BrowserExtension using chrome.identity.launchWebAuthFlow functionality. |
GitHub repositories
This package is not used by any popular GitHub repositories.