Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Production-ready HttpClient ecosystem: resilience patterns + intelligent caching + universal response handlers. Zero config, multiple approaches, seamless substitution.

License

Notifications You must be signed in to change notification settings

planfact/Reliable.HttpClient

Repository files navigation

Reliable.HttpClient

Core Package

NuGet Version NuGet Downloads

Caching Extension

NuGet Version NuGet Downloads

Project Status

Build Status codecov .NET 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.

🎯 Choose Your Approach

Not sure which approach to use? β†’ Read our Choosing Guide

Your Use Case Recommended Approach Documentation
Single API with 1-2 entity types Generic Caching Getting Started
REST API with 5+ entity types Universal Handlers Choosing Guide
Need HttpClient substitution IHttpClientAdapter Substitution Guide
Custom serialization/error handling Custom Response Handler Advanced Usage

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

dotnet add package Reliable.HttpClient
// Add to your Program.cs
builder.Services.AddHttpClient<ApiClient>(c => c.BaseAddress = new Uri("https://api.example.com"))
 .AddResilience(); // That's it! ✨
// Use anywhere
public class ApiClient(HttpClient client)
{
 public async Task<Data> GetDataAsync() =>
 await client.GetFromJsonAsync<Data>("/endpoint");
}
// Need custom headers? Use the adapter pattern:
public class AuthApiClient(IHttpClientAdapter client, ITokenProvider tokens)
{
 public async Task<Data> GetDataAsync(string userId)
 {
 var headers = new Dictionary<string, string>
 {
 { "Authorization", $"Bearer {await tokens.GetTokenAsync(userId)}" }
 };
 return await client.GetAsync<Data>("/endpoint", headers);
 }
}

You now have: Automatic retries + Circuit breaker + Smart error handling

πŸš€ Need details? See Getting Started Guide for step-by-step setup πŸ†• Building REST APIs? Check Universal Response Handlers πŸ”„ Need substitution patterns? See HttpClient Substitution Guide

Key Features

  • Zero Configuration – Works out of the box
  • Resilience – Retry + Circuit breaker
  • Caching – Intelligent HTTP response caching
  • Custom Headers – Default and per-request header support
  • OAuth/Auth Support – Dynamic token handling per request
  • Universal Handlers – Non-generic response handling for REST APIs
  • HttpClient Substitution – Switch between cached/non-cached implementations
  • Production Ready – Used by companies in production

πŸ“– Full Feature List: Documentation

Need Customization?

// Custom settings
.AddResilience(options => options.Retry.MaxRetries = 5);
// Ready-made presets
.AddResilience(HttpClientPresets.SlowExternalApi());

πŸ“– Full Configuration: Configuration Guide

Trusted By

Organizations using Reliable.HttpClient in production:

PlanFact

Documentation

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.

About

Production-ready HttpClient ecosystem: resilience patterns + intelligent caching + universal response handlers. Zero config, multiple approaches, seamless substitution.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /