fm.Extensions.HttpClient 7.0.0

dotnet add package fm.Extensions.HttpClient --version 7.0.0                
NuGet\Install-Package fm.Extensions.HttpClient -Version 7.0.0                
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="fm.Extensions.HttpClient" Version="7.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add fm.Extensions.HttpClient --version 7.0.0                
#r "nuget: fm.Extensions.HttpClient, 7.0.0"                
#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 fm.Extensions.HttpClient as a Cake Addin
#addin nuget:?package=fm.Extensions.HttpClient&version=7.0.0

// Install fm.Extensions.HttpClient as a Cake Tool
#tool nuget:?package=fm.Extensions.HttpClient&version=7.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 and Delete
  • HttpResponseHandler
  • HttpErrorResponseHandler
  • HttpLoggingHandler
  • HttpLoggingHandlerOptions
  • HttpResponseException
  • HttpStatusCodeException
  • ProblemDetails
  • ProblemDetailsHandler
  • MediaType
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
7.0.0 109 11/15/2024
6.0.0 321 3/27/2024
5.0.0 576 3/4/2023
4.0.0 1,891 11/30/2020
3.2.0 637 8/25/2020
2.0.0 2,642 10/9/2017
1.3.0 1,113 8/5/2017
1.2.0 1,537 3/2/2017
1.1.0 1,383 6/29/2016

BREAKING: Target .NET 9