SimplyWorks.HttpExtensions 8.1.0

dotnet add package SimplyWorks.HttpExtensions --version 8.1.0
                    
NuGet\Install-Package SimplyWorks.HttpExtensions -Version 8.1.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="SimplyWorks.HttpExtensions" Version="8.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SimplyWorks.HttpExtensions" Version="8.1.0" />
                    
Directory.Packages.props
<PackageReference Include="SimplyWorks.HttpExtensions" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SimplyWorks.HttpExtensions --version 8.1.0
                    
#r "nuget: SimplyWorks.HttpExtensions, 8.1.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.
#:package SimplyWorks.HttpExtensions@8.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SimplyWorks.HttpExtensions&version=8.1.0
                    
Install as a Cake Addin
#tool nuget:?package=SimplyWorks.HttpExtensions&version=8.1.0
                    
Install as a Cake Tool

SW.HttpExtensions

Build and Publish NuGet Package NuGet Version License: MIT

A lightweight .NET library that provides useful extensions for HTTP operations, including JSON serialization/deserialization, HTTP client factory helpers, and API client abstractions.

Features

  • HttpContent Extensions: Easy JSON deserialization from HTTP responses
  • HttpClient Extensions: Simplified HTTP operations with automatic JSON serialization
  • HttpClientFactory Extensions: Streamlined client creation with authentication and base address setup
  • API Client Framework: Base classes and builders for creating structured API clients
  • JWT Token Support: Built-in JWT authentication helpers
  • Service Collection Extensions: Easy dependency injection setup

Installation

Install via NuGet Package Manager:

dotnet add package SimplyWorks.HttpExtensions

Or via Package Manager Console:

Install-Package SimplyWorks.HttpExtensions

Quick Start

HttpContent Extensions

using SW.HttpExtensions;

// Deserialize JSON response to strongly typed object
var response = await httpClient.GetAsync("api/users");
var users = await response.Content.ReadAsAsync<List<User>>();

HttpClient Extensions

using SW.HttpExtensions;

// POST with automatic JSON serialization
var user = new User { Name = "John", Email = "john@example.com" };
var response = await httpClient.PostAsync("api/users", user);

// POST with automatic deserialization
var createdUser = await httpClient.PostAsync<User>("api/users", user);

// GET with automatic deserialization
var users = await httpClient.GetAsync<List<User>>("api/users");

// PUT with automatic JSON serialization
await httpClient.PutAsync("api/users/1", user);

HttpClientFactory Extensions

using SW.HttpExtensions;

// Create client with base address and JWT authentication
var client = httpClientFactory.CreateClient(
    new Uri("https://api.example.com"), 
    jwt: "your-jwt-token"
);

Service Collection Extensions

using SW.HttpExtensions;

// Add JWT token parameters from configuration
services.AddJwtTokenParameters(options => 
{
    // Configure JWT options
});

// Add API client with options
services.AddApiClient<IUserApi, UserApiClient, UserApiMock, UserApiOptions>(options =>
{
    options.BaseUrl = "https://api.example.com";
    options.Mock = false;
});

Dependencies

  • .NET 8.0
  • Microsoft.AspNetCore.Http.Abstractions (≥2.3.0)
  • Microsoft.Extensions.Configuration.Binder (≥8.0.2)
  • Microsoft.Extensions.Http (≥8.0.1)
  • Newtonsoft.Json (≥13.0.3)
  • SimplyWorks.PrimitiveTypes (≥8.0.0)
  • System.IdentityModel.Tokens.Jwt (≥8.3.1)

License

This project is licensed under the MIT License - see the LICENSE for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

If you encounter any bugs or have feature requests, please submit an issue.

Product 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.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (10)

Showing the top 5 NuGet packages that depend on SimplyWorks.HttpExtensions:

Package Downloads
SimplyWorks.Infolink.Sdk

Package Description

SimplyWorks.Bus

A lightweight .NET 8 message bus library built on RabbitMQ for ASP.NET Core applications. Provides simple publish-subscribe patterns, typed consumers, broadcasting, automatic retries, and JWT integration. Visit GitHub for full documentation and examples.

SimplyWorks.Mtm.Sdk

Package Description

SimplyWorks.CqApi

Convention-based REST API framework for .NET that eliminates boilerplate code by automatically routing HTTP requests to handler classes based on folder structure and namespaces. Build CQRS APIs with zero controllers.

SimplyWorks.ExcelImport

A .NET library for reading, parsing, and validating Excel files with type-safe operations, data annotation validation, and Entity Framework integration. Supports batch processing with comprehensive error handling. See GitHub for full documentation and examples.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
8.1.0 326 9/16/2025
8.0.8 433 5/28/2025
8.0.0 1,916 1/20/2025
6.1.3 894 12/11/2024
6.1.1 2,910 7/24/2023
6.1.0 236 7/24/2023
6.0.2 452 12/12/2024
6.0.0 22,553 2/7/2022
5.1.2 387 1/7/2025
5.1.1 806 12/12/2024
5.0.2 2,610 12/27/2021
5.0.0 51,324 10/23/2021
2.0.46 2,529 10/22/2021
2.0.44 24,728 1/19/2021
2.0.43 9,525 12/17/2020
2.0.42 574 12/17/2020
2.0.40 15,833 12/13/2020
2.0.36 1,344 12/6/2020
2.0.35 1,576 12/3/2020
2.0.34 12,112 11/29/2020
2.0.33 4,396 11/23/2020
2.0.32 4,592 10/12/2020
2.0.31 820 10/10/2020
2.0.30 591 10/10/2020
2.0.29 603 10/10/2020
2.0.28 1,329 9/30/2020
2.0.27 5,870 9/28/2020
2.0.26 1,169 9/22/2020
2.0.25 2,281 9/22/2020
2.0.24 1,447 9/17/2020
2.0.23 722 9/17/2020
2.0.22 771 9/17/2020
2.0.21 578 9/17/2020
2.0.20 4,609 9/15/2020
2.0.19 1,909 9/14/2020
2.0.18 2,316 9/12/2020
2.0.17 568 9/12/2020
2.0.16 1,105 9/10/2020
2.0.15 559 9/10/2020
2.0.14 2,253 9/8/2020
2.0.13 690 9/8/2020
2.0.12 2,572 8/31/2020
2.0.11 729 8/30/2020
2.0.8 1,004 8/24/2020
2.0.7 551 8/24/2020
2.0.6 857 8/21/2020
2.0.5 590 8/21/2020
2.0.4 768 8/21/2020
2.0.3 8,551 8/5/2020
2.0.2 1,039 8/5/2020
2.0.1 10,760 7/30/2020
2.0.0 741 7/30/2020