-
Notifications
You must be signed in to change notification settings - Fork 0
V2.5.0 #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Introduce RetryableHttpErrorHandler abstract base for transient error handling - Add TransientHttpErrorHandler for multiple status codes - Refactor HttpError429Handler and HttpError503Handler to use new base class - Update project versions to 2.5.0 and copyright to 2025 - Relax Newtonsoft.Json and System.Text.Json package versions - Improve HttpRequestMessageCloneManager disposal logic - Minor variable renaming and add namespace documentation stub
- Target .NET 10.0 in all test projects; update NUnit3TestAdapter to 6.0.1 - Replace deprecated Assert.Multiple with Assert.EnterMultipleScope - Use C# 12 collection expressions in assertions - Add TransientHttpErrorHandlerTests for coverage of transient error handling and backoff logic - Introduce TestStream helper for seekable/non-seekable stream tests - Refactor tests to use TestStream for content reusability checks - Add tests for compressed content retry scenarios (gzip/deflate) - Minor assertion improvements for clarity and consistency - Modernize and improve maintainability of the test suite
Switched GitHub Actions workflow to use .NET SDK 10.0.x. Set keep_files: false in gh-pages deploy to remove old files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request introduces version 2.5.0 of Kampute.HttpClient with enhancements to HTTP error handling architecture, .NET 10.0 support, and dependency updates. The main focus is on introducing a reusable abstraction for retryable HTTP error handlers and modernizing test infrastructure.
Key changes include:
- Introduction of
RetryableHttpErrorHandlerabstract base class to centralize retry logic for transient HTTP errors, with refactoredHttpError429HandlerandHttpError503Handlerimplementations - New
TransientHttpErrorHandlerfor handling multiple transient error status codes (408, 502, 503, 504, 507, 509) with a single configurable handler - Upgrade to .NET 10.0 SDK and target framework across all test projects, with NUnit 6.0.1 test adapter and wildcard package version specifications
Reviewed changes
Copilot reviewed 55 out of 55 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Kampute.HttpClient/ErrorHandlers/Abstracts/RetryableHttpErrorHandler.cs | New abstract base class providing reusable retry logic with customizable backoff strategies for transient HTTP errors |
| src/Kampute.HttpClient/ErrorHandlers/TransientHttpErrorHandler.cs | New handler supporting multiple configurable transient error status codes (408, 502, 503, 504, 507, 509) |
| src/Kampute.HttpClient/ErrorHandlers/HttpError429Handler.cs | Refactored to inherit from RetryableHttpErrorHandler, now uses rate limit reset header with no-retry default |
| src/Kampute.HttpClient/ErrorHandlers/HttpError503Handler.cs | Simplified by inheriting from RetryableHttpErrorHandler, leveraging base class retry logic |
| src/Kampute.HttpClient/ErrorHandlers/Abstracts/NamespaceDoc.cs | Documentation-only class describing the abstracts namespace purpose |
| src/Kampute.HttpClient/HttpRestClient.cs | Minor variable renaming for consistency (context → ctx) |
| src/Kampute.HttpClient/HttpRequestMessageCloneManager.cs | Refactored DisposeNonOriginalRequest to use early return pattern for improved readability |
| src/Kampute.HttpClient/Kampute.HttpClient.csproj | Version bump to 2.5.0 and copyright year update to 2025 |
| src/Kampute.HttpClient./Kampute.HttpClient..csproj | Version bumps to 2.5.0 and copyright year updates to 2025 for all extension packages |
| src/Kampute.HttpClient.Json/Kampute.HttpClient.Json.csproj | System.Text.Json dependency changed to wildcard version "10.*" |
| src/Kampute.HttpClient.NewtonsoftJson/Kampute.HttpClient.NewtonsoftJson.csproj | Newtonsoft.Json dependency changed to wildcard version "13.*" |
| tests//Kampute.HttpClient..Test.csproj | Target framework upgraded from net8.0 to net10.0, NUnit3TestAdapter updated to 6.0.1 |
| tests/Kampute.HttpClient.Test/TestHelpers/TestStream.cs | New test helper for creating seekable/non-seekable streams in tests |
| tests/Kampute.HttpClient.Test/HttpRestClientTests.cs | Added test for compressed content retry behavior, typo fix in test name, collection expression syntax updates |
| tests/Kampute.HttpClient.Test/ErrorHandlers/TransientHttpErrorHandlerTests.cs | Comprehensive test coverage for new TransientHttpErrorHandler including constructor validation and retry behavior |
| tests/Kampute.HttpClient.Test/HttpContentExtensionsTests.cs | Added tests for IsReusable with compressed content, replaced nested NonSeekableMemoryStream with shared TestStream |
| tests/Kampute.HttpClient.Test/HttpRequestMessageExtensionsTests.cs | Refactored to use shared TestStream helper, removed duplicate test class definition |
| tests/**/*Tests.cs | Converted Assert.Multiple to Assert.EnterMultipleScope for NUnit compatibility, collection expression syntax updates |
| .github/workflows/main.yml | Updated to use .NET SDK 10.0.x, added keep_files: false to GitHub Pages deployment |
This pull request introduces several improvements and updates across the codebase, focusing primarily on enhancing HTTP error handling and updating dependencies to support .NET 10.0 and newer library versions. The most significant changes are the introduction of a new abstract base class for retryable HTTP error handling and a refactor of the
HttpError429Handlerto leverage this abstraction. Additionally, there are updates to project metadata and dependency versions, as well as workflow configuration changes.HTTP Error Handling Improvements
RetryableHttpErrorHandlerinsrc/Kampute.HttpClient/ErrorHandlers/Abstracts/RetryableHttpErrorHandler.cs, which provides a reusable mechanism for handling transient HTTP errors with customizable backoff and retry strategies. This class is designed to be extended for specific error codes and centralizes retry logic.HttpError429Handlerinsrc/Kampute.HttpClient/ErrorHandlers/HttpError429Handler.csto inherit fromRetryableHttpErrorHandler, simplifying its implementation and aligning its retry logic with the new abstraction. The handler now uses a rate limit reset header for retry timing and disables retries if not present.NamespaceDoctosrc/Kampute.HttpClient/ErrorHandlers/Abstracts/NamespaceDoc.csto clarify the purpose of the error handler abstracts namespace.Dependency and SDK Updates
.github/workflows/main.ymlto use .NET SDK 10.0.x instead of 8.0.x, ensuring compatibility with the latest .NET features.Kampute.HttpClient.Json.csproj,Kampute.HttpClient.NewtonsoftJson.csproj) to use wildcard versions (10.*forSystem.Text.Jsonand13.*forNewtonsoft.Json), allowing for automatic updates to the latest minor and patch releases. [1] [2]Project Metadata Updates
2.4.0to2.5.0and updated copyright years to 2025 inKampute.HttpClient.DataContract.csproj,Kampute.HttpClient.NewtonsoftJson.csproj, andKampute.HttpClient.Xml.csprojto reflect the new release. [1] [2] [3]Workflow Configuration
keep_files: falsein the GitHub Pages deployment step to ensure old files are removed during publish, preventing stale content. (.github/workflows/main.yml)