Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
d5f4665
Surface request failures from non-generic form helpers
Khojasteh Oct 3, 2026
2286e6c
Synchronize access to default request headers during re-authentication
Khojasteh Oct 3, 2026
3bac27e
Re-authenticate only once per expired token
Khojasteh Oct 3, 2026
e0024ff
Fix the 401 handler example in the documentation
Khojasteh Oct 3, 2026
8dd5db4
Add AI Coding Assistant instructions to AGENTS.md
Khojasteh Oct 3, 2026
706d408
Add a .NET Framework 4.8 test project
Khojasteh Oct 3, 2026
5f764eb
Run the .NET Framework tests in CI
Khojasteh Oct 3, 2026
44d27f0
Keep request content usable for retries on .NET Framework
Khojasteh Oct 3, 2026
d475139
Validate server-supplied retry times
Khojasteh Oct 3, 2026
e059278
Cap waits suggested by the server
Khojasteh Oct 3, 2026
d485564
Give each kind of failure its own retry budget
Khojasteh Oct 3, 2026
b424031
Document that error responses are disposed
Khojasteh Oct 3, 2026
face49c
Stream the response body in stream and download helpers
Khojasteh Oct 3, 2026
869ae59
Make jitter thread-safe
Khojasteh Oct 3, 2026
0418255
Release clients held by serializer settings
Khojasteh Oct 3, 2026
0729887
Remove the HttpRestClient finalizer
Khojasteh Oct 3, 2026
c2ec0ba
Bound the deserializer cache and match media types ignoring case
Khojasteh Oct 3, 2026
243ea84
Close the race in the SharedHttpClient.Factory setter
Khojasteh Oct 3, 2026
a3fd5d9
Skip 401 re-authentication for requests that cannot be sent again
Khojasteh Oct 3, 2026
6e2393c
Apply ConfigureAwait and documentation conventions consistently
Khojasteh Oct 3, 2026
68ffbcb
Fix typos in XML documentation
Khojasteh Oct 3, 2026
333523d
Keep per-call retry budgets in a state object owned by the dispatch
Khojasteh Oct 3, 2026
c4bc957
Make the clone manager internal and dispose content by ownership
Khojasteh Oct 3, 2026
91ac287
Pass the response context to the DynamicHttpErrorHandler delegate
Khojasteh Oct 3, 2026
fe2ff44
Throw argument exceptions when async methods are called
Khojasteh Oct 3, 2026
8a7de41
Replace response deserializers with two-way content formatters
Khojasteh Oct 3, 2026
de84544
Move XML support into the core with one formatter for both serializers
Khojasteh Oct 3, 2026
42329b0
Rebuild the System.Text.Json package on a two-way formatter
Khojasteh Oct 3, 2026
8446686
Rebuild the Newtonsoft.Json package on a two-way formatter
Khojasteh Oct 3, 2026
e6ae40c
Target net10.0 instead of netstandard2.1
Khojasteh Oct 3, 2026
1778631
Set the base status code of HttpResponseException on .NET 10
Khojasteh Oct 3, 2026
8c86f4f
Use HttpRequestMessage.Options for request properties on .NET 10
Khojasteh Oct 3, 2026
529dad9
Move the retry mechanism into a general-purpose Kampute.Retry package
Khojasteh Oct 3, 2026
ae0455f
Build the HTTP retry API on Kampute.Retry with policy names
Khojasteh Oct 3, 2026
cdf6e17
Set the package versions to 3.0.0
Khojasteh Oct 3, 2026
af5ea40
Review the documentation against the 3.0.0 API
Khojasteh Oct 3, 2026
c93217b
Enforce the retry delay limit on every error response
Khojasteh Oct 3, 2026
356cae9
Dispose the response when opening its body stream fails
Khojasteh Oct 3, 2026
399a3be
Organize documentation and link API references
Khojasteh Oct 3, 2026
da63134
Replace the Kampute.Retry project with the Kampute.Resilience package
Khojasteh Oct 5, 2026
f9fe3f9
Suppress finalization when HttpError401Handler is disposed
Khojasteh Oct 5, 2026
c02150e
Revise the user guide and READMEs
Khojasteh Oct 5, 2026
37ab965
Revise the XML documentation comments
Khojasteh Oct 5, 2026
5eb20e4
Leave the original length out of compressed content
Khojasteh Oct 5, 2026
ca315b1
Update Kampose configuration
Khojasteh Oct 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
221 changes: 0 additions & 221 deletions .github/copilot-instructions.md

This file was deleted.

14 changes: 14 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,17 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./.site
keep_files: false

test-net-framework:
runs-on: windows-latest

steps:
- uses: actions/checkout@v4

- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: '10.0.x'

- name: Test .NET Framework Build
run: dotnet test tests/Kampute.HttpClient.NetFramework.Test --verbosity minimal
56 changes: 56 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Kampute.HttpClient - AI Coding Assistant Instructions

## Project Overview

Kampute.HttpClient is a .NET library that enhances the native `HttpClient` for simplified RESTful API communication. It provides a modular, extensible architecture with shared connection pooling, scoped request customization, and automatic content deserialization.

## Architecture & Design Patterns

### Core Components
- **`HttpRestClient`**: Main client class wrapping `HttpClient` with enhanced features
- **Content Formats**: XML support in the core (`Kampute.HttpClient.Xml` namespace) and extension packages for JSON (`Json`, `NewtonsoftJson`)
- **Shared HttpClient**: Connection pooling via `SharedHttpClient` for efficient resource management
- **Scoped Collections**: `ScopedCollection<T>` for temporary header/property overrides

### Key Design Patterns
- **Fluent API**: Extension methods for HTTP verbs (`GetAsync<T>`, `PostAsJsonAsync`, etc.)
- **Event-driven**: `BeforeSendingRequest`/`AfterReceivingResponse` events for interception
- **Strategy Pattern**: `IHttpRetryPolicy` for configurable retry logic, built on `IRetryStrategy` from the `Kampute.Resilience` package
- **Factory Pattern**: `RetryStrategies` (in `Kampute.Resilience`) for creating retry strategies, and `ToHttpRetryPolicy()` to use one for HTTP requests
- **Decorator Pattern**: `HttpRequestScope` for fluent request configuration

### Request Flow
1. **Request Creation**: `CreateHttpRequest()` builds `HttpRequestMessage` with headers/properties
2. **Pre-processing**: `BeforeSendingRequest` event allows modification
3. **Dispatch**: `DispatchAsync()` sends via underlying `HttpClient`
4. **Retry Logic**: `DispatchWithRetriesAsync()` handles failures with retry policies
5. **Response Processing**: `DeserializeContentAsync()` converts response to .NET objects
6. **Post-processing**: `AfterReceivingResponse` event for inspection/logging

## Critical Developer Workflows

### Building & Testing
```bash
# Build solution
dotnet build -c Release

# Run all tests
dotnet test --verbosity minimal

# Run specific test project
dotnet test tests/Kampute.HttpClient.Test/

# Generate documentation
kampose build
```

### Adding New Features
1. **Core Features**: Modify `HttpRestClient.cs` and add tests in corresponding test file
2. **Extensions**: Create new package in `src/Kampute.HttpClient.*` with matching test project
3. **Serialization**: Derive from `HttpContentFormatter` (or implement `IHttpContentFormatter`) and add to `ContentFormatters`

### Debugging Common Issues
- **Connection Pooling**: Use `SharedHttpClient` reference counting for proper disposal
- **Header Conflicts**: Scoped headers override defaults; avoid setting headers on underlying `HttpClient`
- **Serialization Failures**: Check that the `ContentFormatters` collection has a formatter that reads (for responses) or writes (for `SendObjectAsync` payloads) the media type
- **Retry Behavior**: Verify `RetryPolicy` is set and `ErrorHandlers` are configured
Loading
Loading