Kaz.Http 1.0.0-beta

Prefix Reserved
This is a prerelease version of Kaz.Http.
dotnet add package Kaz.Http --version 1.0.0-beta
                    
NuGet\Install-Package Kaz.Http -Version 1.0.0-beta
                    
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="Kaz.Http" Version="1.0.0-beta" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Kaz.Http" Version="1.0.0-beta" />
                    
Directory.Packages.props
<PackageReference Include="Kaz.Http" />
                    
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 Kaz.Http --version 1.0.0-beta
                    
#r "nuget: Kaz.Http, 1.0.0-beta"
                    
#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 Kaz.Http@1.0.0-beta
                    
#: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=Kaz.Http&version=1.0.0-beta&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Kaz.Http&version=1.0.0-beta&prerelease
                    
Install as a Cake Tool

Kaz.Http

A resilient HTTP client for .NET 6+ with retry, caching, rate limiting, circuit breaker, bulkhead isolation, fallback routing, telemetry, and request signing.

NuGet Version NuGet Downloads .NET Language

Latest Release Release Date GitHub Downloads Commits since release


Installation

dotnet add package Kaz.Http
Install-Package Kaz.Http

What's Inside

Feature Description
Retry Automatic retry with exponential backoff and 429 Retry-After support
Caching ETag-based response caching with deduplication of concurrent GET requests
Rate Limiting Per-host request rate limiting with configurable window
Circuit Breaker Prevents cascading failures with configurable threshold and recovery timeout
Bulkhead Limits concurrent requests per host via semaphore isolation
Fallback Routing Redirects to a backup URL when the primary fails after all retries
Request Signing Adds HMAC-SHA256 X-Timestamp and X-Signature headers
Contracts Post-deserialization response validation with custom rules
Telemetry Tracks total requests, errors, and last request duration

How to use

GET

var response = await Client.GetAsync<WeatherData>("https://api.example.com/weather");

if (response.IsSuccess)
    Console.WriteLine(response.Data);

// Authenticated
var response = await Client.GetAsync<WeatherData>("https://api.example.com/weather", apiKey);

POST

var response = await Client.PostAsync<CreateUserRequest, UserResponse>(
    "https://api.example.com/users",
    new CreateUserRequest { Name = "Alice" });

// Authenticated
var response = await Client.PostAsync<CreateUserRequest, UserResponse>(
    "https://api.example.com/users", apiKey,
    new CreateUserRequest { Name = "Alice" });

PUT

var response = await Client.PutAsync<UpdateUserRequest, UserResponse>(
    "https://api.example.com/users/1",
    new UpdateUserRequest { Name = "Bob" });

PATCH

var response = await Client.PatchAsync<PatchRequest, UserResponse>(
    "https://api.example.com/users/1",
    new PatchRequest { Name = "Bob" });

DELETE

var response = await Client.DeleteAsync<DeleteResponse>("https://api.example.com/users/1");
// Returns headers only
var response = await Client.HeadAsync<object>("https://api.example.com/users");

if (response.IsSuccess)
    Console.WriteLine(response.Headers);

Configuration

Retry

Client.RetryCount = 3;     // default: 3
Client.RetryDelay = 1000;  // initial delay in ms, doubles on each retry (default: 1000)

Circuit Breaker

Client.CircuitBreakerFailureThreshold = 3;                        // default: 3
Client.CircuitBreakerRecoveryTimeout = TimeSpan.FromSeconds(30);  // default: 30s

Rate Limiting

Client.RateLimiterMaxRequests = 100;                 // default: 100
Client.RateLimiterPeriod = TimeSpan.FromSeconds(1);  // default: 1s

Timeout

Client.SetTimeout("https://api.example.com", TimeSpan.FromSeconds(10));

Bulkhead

Client.SetBulkhead("https://api.example.com", maxConcurrent: 5);

Fallback URL

Client.RegisterFallbackUrl(
    "https://api.example.com/data",
    "https://backup.example.com/data");

Request Signing

Client.SigningKey = "your-secret-key";

Response Contracts

Client.AddContract<UserResponse>(user =>
    user.Id > 0 ? null : "Invalid user ID.");

Default Headers

Client.AddDefaultHeader("X-App-Version", "2.0.0");

Telemetry

Console.WriteLine(Client.Telemetry.TotalRequests);  // total requests sent
Console.WriteLine(Client.Telemetry.Errors);         // total failed requests
Console.WriteLine(Client.Telemetry.Duration);       // last request duration in ms

License

This project is distributed under the MIT License — free for personal and commercial use.


Contact

NuGet LinkedIn

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

    • No dependencies.
  • net7.0

    • No dependencies.
  • net8.0

    • No dependencies.

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
1.0.0-beta 34 3/22/2026