DP.MinimalHttp 2.0.0

dotnet add package DP.MinimalHttp --version 2.0.0
                    
NuGet\Install-Package DP.MinimalHttp -Version 2.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="DP.MinimalHttp" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DP.MinimalHttp" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="DP.MinimalHttp" />
                    
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 DP.MinimalHttp --version 2.0.0
                    
#r "nuget: DP.MinimalHttp, 2.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.
#:package DP.MinimalHttp@2.0.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=DP.MinimalHttp&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=DP.MinimalHttp&version=2.0.0
                    
Install as a Cake Tool

DP.MinimalHttp

🚀 The simplest way to use HttpClient in .NET — with automatic JSON deserialization and zero boilerplate.

NuGet License: MIT

Features

  • Zero-config HttpClient setup.
  • Automatic JSON deserialization into SuccessModel or ErrorModel.
  • Minimal API: Just 2-3 methods to handle all HTTP requests.

Getting Started

1.Install DP.MinimalHttp using cli or NuGet plugin of your IDE

  dotnet add package DP.MinimalHttp

2.Register your HttpClientOptions and HttpClient

appsettings.json
{
  "TargetHttpClientOptions": {
    "BaseUri": "www.Foo.com",
    "HttpClientLoggingMode": 3, // *Optional* 3 means Request and Response will be logged
    "HealthCheckPath": "/healthz", // *Optional*
    "Timeout": "00:01:00", // *Optional*
    "CertificateThumbprint": "b8bb81876833873942045a8df8f06219e00602ebcb4384c7abc24f18379c87f5", // *Optional* IgnoreCertificate will surpress this option 
    "IgnoreCertificate": true // *Optional*
  }
}
TargetHttpClientOptions.cs
    public class TargetHttpClientOptions : HttpClientOptions
    {}
Program.cs
    // Setup TargetHttpClientOptions from your appsettings.json 
    services.Configure<TargetHttpClientOptions>(
        configuration.GetSection("TargetHttpClientOptions")
    );

    // Register an HttpClient for class 'TargetClient'
    services.AddHttpClient<TargetClient, TargetHttpClientOptions>();

3.You are good to go! use your httpClient!

TargetClient.cs
    public class TargetClient
    {
        private readonly HttpClient _client;
        private readonly Ilogger _logger;
        public TargetClient(ILogger<TargetClient> logger, HttpClient client)
        {
            _client = client;
            _logger = logger;
        }

        public Task<TargetSuccessModel> CoolMethodCall()
        {
            try
            {
                var request = new HttpRequestMessage(HttpMethod.Get, "/Bar");
                TargetSuccessModel response = await _client.SendAsync<TargetSuccessModel, TargetErrorModel>(request, _logger);

                return response;
            }
            catch (ExternalProviderException<TargetErrorModel> ex)
            {
                // anything you like to do with target failure 
                // you have access to deserialized TargetErrorModel from ex.ErrorModel

                throw;
            }
        }
    }

More Features

Creating request with query parameters:
    var parameters = new Dictionary<string, string>
    {
        ["param1"] = "ABCD",
        ["param2"] = "2",
        ["param3"] = "true",
    };
    var relativeUri = new Uri("service/address", UriKind.Relative);
    var uri = MinimalHttpHelpers.GenerateQueryParamUri(httpClient.BaseAddress, relativeUri, parameters);
    
    //Result: <BaseAddress>/service/address?param1=ABCD&param2=2&param3=true

Creating request with Json body:
    var model = new 
    {
        param1 = "ABCD",
        param2 = 2,
        param3 = true
    };

    var httpRequest = new HttpRequestMessage();

    // Adds JsonContent to body of request
    httpRequest.AddJsonContent(model);
More complex scenarios (AddJsonContent vs AddJsonContentFreeStyle):
    public class ParentType
    {
        public string A { get; set; }
    }

    public class ChildType : ParentType
    {
        public string B { get; set; }
    }

    public Task MethodA(ParentType model)
    {
        var httpRequest = new HttpRequestMessage();

        // lets assume passed model to this method is a 'ChildType' which is also a 'ParentType' 

        // As model is ParentType serialized model will have just parameter 'A'
        httpRequest.AddJsonContent(model);

        // As model is actually a 'ChildType' serialized model will have both parameters 'A' and 'B'
        httpRequest.AddJsonContentFreeStyle(model);
    }
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 is compatible.  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 is compatible.  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

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
2.0.0 121 4/10/2026
1.7.0 99 3/21/2026
1.6.0 213 7/14/2025
1.5.1 277 5/15/2025
1.5.0 191 4/24/2025
1.4.0 237 4/13/2025
1.3.1 211 4/1/2025
1.3.0 198 3/31/2025
1.2.0-alpha 211 3/31/2025
1.1.0-alpha 195 3/31/2025
1.0.0-alpha 202 3/31/2025