Reliable.HttpClient 1.0.0

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

Reliable.HttpClient

Core Package

NuGet Version NuGet Downloads

Caching Extension

NuGet Version NuGet Downloads

Project Status

Build Status License

A comprehensive resilience and caching ecosystem for HttpClient with built-in retry policies, circuit breakers, and intelligent response caching. Based on Polly but with zero configuration required.

Packages

Package Purpose Version
Reliable.HttpClient Core resilience (retry + circuit breaker) dotnet add package Reliable.HttpClient
Reliable.HttpClient.Caching HTTP response caching extension dotnet add package Reliable.HttpClient.Caching

Why Choose This Ecosystem?

  • Zero Configuration: Works out of the box with sensible defaults
  • Complete Solution: Resilience + Caching in one ecosystem
  • Lightweight: Minimal overhead, maximum reliability
  • Production Ready: Used by companies in production environments
  • Easy Integration: One line of code to add resilience, two lines for caching
  • Secure: SHA256-based cache keys prevent collisions and attacks
  • Flexible: Use core resilience alone or add caching as needed

Quick Start

1️⃣ Install & Add Resilience (2 lines of code)

dotnet add package Reliable.HttpClient
builder.Services.AddHttpClient<WeatherApiClient>(c =>
{
    c.BaseAddress = new Uri("https://api.weather.com");
})
.AddResilience(); // ✨ That's it! Zero configuration needed

You now have:

  • Automatic retries (3 attempts with smart backoff)
  • Circuit breaker (prevents cascading failures)
  • Smart error handling (5xx, timeouts, rate limits)

2️⃣ Add Caching (Optional)

Want to cache responses? Add one more package and line:

dotnet add package Reliable.HttpClient.Caching
builder.Services.AddMemoryCache(); // Standard .NET caching

builder.Services.AddHttpClient<WeatherApiClient>(c =>
{
    c.BaseAddress = new Uri("https://api.weather.com");
})
.AddResilience()
.AddMemoryCache<WeatherResponse>(); // ✨ Intelligent caching added!

Now you also have:

  • Automatic response caching (5-minute default)
  • Smart cache keys (collision-resistant SHA256)
  • Manual cache invalidation

3️⃣ Use Your Client

public class WeatherService
{
    private readonly HttpClient _client;

    public WeatherService(IHttpClientFactory factory)
    {
        _client = factory.CreateClient<WeatherApiClient>();
    }

    public async Task<WeatherResponse> GetWeatherAsync(string city)
    {
        // This call now has retry, circuit breaker, AND caching!
        var response = await _client.GetAsync($"/weather?city={city}");
        return await response.Content.ReadFromJsonAsync<WeatherResponse>();
    }
}

🎯 That's it! You're production-ready with 2-3 lines of configuration.

What You Get

  • Retry Policy: 3 attempts with exponential backoff + jitter
  • Circuit Breaker: Opens after 5 failures, stays open for 1 minute
  • Smart Error Handling: Retries on 5xx, 408, 429, and network errors
  • HTTP Response Caching: 5-minute default expiry with SHA256 cache keys
  • Multiple Configuration Options: Zero-config, presets, or custom setup
  • Production Ready: Used by companies in production environments

📖 See Key Features Table for complete feature comparison

Advanced Configuration (Optional)

Need custom settings? Multiple ways to configure:

// Option 1: Traditional configuration
builder.Services.AddHttpClient<ApiClient>()
    .AddResilience(options => options.Retry.MaxRetries = 5);

// Option 2: Fluent builder
builder.Services.AddHttpClient<ApiClient>()
    .AddResilience(builder => builder.WithRetry(r => r.WithMaxRetries(5)));

// Option 3: Ready-made presets
builder.Services.AddHttpClient<ApiClient>()
    .AddResilience(HttpClientPresets.SlowExternalApi());

📖 See Configuration Guide for complete configuration options## Trusted By

Organizations using Reliable.HttpClient in production:

PlanFact

Documentation

Complete Example

Here's a complete working example showing both packages in action:

The Service

public class WeatherService
{
    private readonly HttpClient _httpClient;

    public WeatherService(IHttpClientFactory httpClientFactory)
    {
        _httpClient = httpClientFactory.CreateClient<WeatherApiClient>();
    }

    public async Task<WeatherData> GetWeatherAsync(string city)
    {
        // This call has retry, circuit breaker, AND caching automatically!
        var response = await _httpClient.GetAsync($"/weather?city={city}");
        response.EnsureSuccessStatusCode();

        return await response.Content.ReadFromJsonAsync<WeatherData>();
    }
}

The Registration

// In Program.cs
services.AddMemoryCache();

services.AddHttpClient<WeatherApiClient>(c =>
{
    c.BaseAddress = new Uri("https://api.weather.com");
    c.DefaultRequestHeaders.Add("API-Key", "your-key");
})
.AddResilience()                    // Retry + Circuit breaker
.AddMemoryCache<WeatherData>();     // Response caching

That's it! Production-ready HTTP client with resilience and caching in just a few lines. 🚀

Contributing

Contributions are welcome! Please read our Contributing Guide for details.

License

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

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 was computed.  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 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 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 (2)

Showing the top 2 NuGet packages that depend on Reliable.HttpClient:

Package Downloads
Reliable.HttpClient.Caching

Intelligent HTTP response caching for Reliable.HttpClient with preset-based configuration, automatic memory management, and zero-setup convenience methods.

KodySu.Client

Типобезопасный клиент для API kody.su (поиск информации по телефонным номерам).

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 122 8/29/2025
1.0.0-alpha1 128 8/29/2025

🎉 Stable v1.0.0 Release!

     ✨ Features:
     • Fluent configuration API with HttpClientOptionsBuilder
     • 6 predefined presets for common scenarios (FastInternalApi, SlowExternalApi, etc.)
     • Retry policies with exponential backoff and jitter
     • Circuit breaker pattern implementation
     • Zero-configuration setup with sensible defaults
     • HTTP response handling with typed responses
     • Full .NET 6.0, 8.0, 9.0 support

     🔧 What's New in v1.0:
     • Stable public API with semantic versioning commitment
     • Production-ready defaults based on industry best practices
     • Comprehensive documentation and examples
     • Complete test coverage

     🚀 Quick Start: services.AddHttpClient("api").AddResilience();

     See full documentation at: https://github.com/akrisanov/Reliable.HttpClient