About WebSpark.HttpClientUtility
A production-ready NuGet library that eliminates boilerplate HTTP code while providing enterprise-grade features.
Purpose
WebSpark.HttpClientUtility was created to solve common challenges when working with HttpClient in .NET applications:
- Reduce Boilerplate: Eliminate repetitive HTTP client setup code
- Add Resilience: Built-in retry logic and circuit breakers
- Enable Caching: Automatic response caching with minimal configuration
- Improve Observability: Comprehensive telemetry and distributed tracing
- Simplify Testing: Mock service for easy unit testing
Architecture
The library uses a decorator pattern to compose features. This design allows you to:
- Enable only the features you need
- Maintain clean separation of concerns
- Extend with custom decorators
- Test each layer independently
Decorator Chain
User Code
↓
IHttpRequestResultService (Interface)
↓
HttpRequestResultServiceTelemetry (Optional - Outermost)
↓
HttpRequestResultServicePolly (Optional - Resilience)
↓
HttpRequestResultServiceCache (Optional - Caching)
↓
HttpRequestResultService (Base - Core HTTP)
Each decorator wraps the layer below it, adding functionality while maintaining the same interface.
Technology Stack
- Frameworks: .NET 8.0 (LTS), .NET 9.0, .NET 10.0
- Resilience: Polly for retry and circuit breaker patterns
- Caching: Microsoft.Extensions.Caching.Memory
- Telemetry: OpenTelemetry with OTLP support
- Testing: MSTest with Moq for mocking
Version History
v2.5.0 (Current)
- Lockstep release metadata update across base, crawler, and testing packages
- Documentation and demo site refreshed to current feature set and versioning
- Stability and maintenance updates with no API breaking changes
v2.4.0
- Tooling and dependency modernization across .NET and npm build pipelines
- Demo UX updates for batch execution workflows
- Documentation output refresh
v2.3.0
- Added batch execution orchestration in the base package
- Added template substitution, concurrency controls, progress, and streaming sinks
- Added aggregate statistics with P50/P95/P99 latency percentiles
v2.2.0
- Modern Vite/NPM build pipeline for demo application
- Enhanced NuGet package quality with Source Link and symbol packages
- Trimming and AOT readiness annotations
- Zero-warning build pipeline
v2.1.0
- Added .NET 10 multi-targeting support
- Updated Microsoft.Extensions packages to 10.0.0
- All tests passing on .NET 8, 9, and 10
v2.0.0
- Major: Package split into base + crawler packages
- Base package reduced to 163 KB with 10 dependencies
- Zero breaking changes for core HTTP users
Quality Assurance
- Comprehensive automated test coverage: Validated across .NET 8, 9, and 10 with MSTest
- Strong Naming: Assembly signed for enterprise scenarios
- Nullable Reference Types: Full nullability annotations
- Code Analysis: Warning level 5 with .NET analyzers enabled
- Multi-Targeting: .NET 8 LTS, .NET 9, and .NET 10 supported
- Source Link: Step-through debugging with symbol packages
- Zero-Warning Builds: Strict code quality enforcement
Contributing
We welcome contributions! Here's how you can help:
- Report Issues: Found a bug? Open an issue
- Suggest Features: Have an idea? Start a discussion
- Submit PRs: Want to contribute code? Read the contributing guide
Development Setup
# Clone the repository
git clone https://github.com/markhazleton/WebSpark.HttpClientUtility.git
# Restore dependencies
dotnet restore
# Build
dotnet build --configuration Release
# Run tests
dotnet test --configuration Release
Code of Conduct
This project follows the Contributor Covenant Code of Conduct.
License
MIT License - free for commercial and open-source use.
Copyright (c) 2024 Mark Hazleton
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
Credits
Author
Mark Hazleton
- GitHub: @markhazleton
- Website: markhazleton.com
Built With
- Polly - Resilience and transient-fault-handling library
- OpenTelemetry - Observability framework
- Microsoft.Extensions.Caching - Caching abstractions
- MSTest - Testing framework
Acknowledgments
Thank you to all contributors and users who have helped make this library better through feedback, bug reports, and pull requests.
Project Status
Active: This project is actively maintained and accepting contributions.
- ✅ Regular updates and bug fixes
- ✅ Support for latest .NET versions
- ✅ Responsive to issues and questions
- ✅ Open to feature requests
Community
Statistics
- Version: 2.5.0
- Total Downloads: 4.4K
- Target Frameworks: .NET 8.0, .NET 9.0, .NET 10.0
- Test Coverage: Comprehensive automated coverage across .NET 8, .NET 9, and .NET 10
- License: MIT