fm.Extensions.HttpClient
6.0.0
See the version list below for details.
dotnet add package fm.Extensions.HttpClient --version 6.0.0
NuGet\Install-Package fm.Extensions.HttpClient -Version 6.0.0
<PackageReference Include="fm.Extensions.HttpClient" Version="6.0.0" />
paket add fm.Extensions.HttpClient --version 6.0.0
#r "nuget: fm.Extensions.HttpClient, 6.0.0"
// Install fm.Extensions.HttpClient as a Cake Addin #addin nuget:?package=fm.Extensions.HttpClient&version=6.0.0 // Install fm.Extensions.HttpClient as a Cake Tool #tool nuget:?package=fm.Extensions.HttpClient&version=6.0.0
Extensions for System.Net.Http
(especially HttpClient
).
Provides convenient methods like GetVerified
, PostVerified
, PostAsJsonVerified
and more which take care of error handling for you.
Also supports RFC 7807 (Problem Details).
Examples
HttpLogger (with content logging)
services.AddOptions<HttpLoggerOptions>("HTTP")
.PostConfigure(o =>
{
o.LogContent = true;
// o.ContentFormatter = (_, c) => c;
});
services.AddHttpClient("HTTP")
.RemoveAllLoggers()
.AddHttpLogger();
Results in the following log message.
HTTP[200]: Information: POST https://localhost/Test -> OK (200); 2ms
Request (application/json; charset=utf-8): {"id":1}
Response (application/json; charset=utf-8): {"id":1,"text":"Test"}
Commonly Used Types
HttpClientExtensions
GetVerified
GetWithResult
PostVerified
PostAsJsonVerified
PostWithResult
PostAsJsonWithResult
- and more for
Put
,Patch
andDelete
HttpResponseHandler
HttpErrorResponseHandler
HttpLoggingHandler
HttpLoggingHandlerOptions
HttpResponseException
HttpStatusCodeException
ProblemDetails
ProblemDetailsHandler
MediaType
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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. |
-
net8.0
- Microsoft.Extensions.Http (>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
BREAKING: Target .NET 8
BREAKING: Remove redundant `MediaType` as `MediaTypeNames` has been expanded in .NET 8.
BREAKING: Replace `HttpLoggingHandler` with `HttpLogger` to use the `IHttpClientLogger` capability of `IHttpClientFactory`.