Koto.Infrastructure.Http
0.1.0-preview.5
This is a prerelease version of Koto.Infrastructure.Http.
dotnet add package Koto.Infrastructure.Http --version 0.1.0-preview.5
NuGet\Install-Package Koto.Infrastructure.Http -Version 0.1.0-preview.5
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="Koto.Infrastructure.Http" Version="0.1.0-preview.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Koto.Infrastructure.Http" Version="0.1.0-preview.5" />
<PackageReference Include="Koto.Infrastructure.Http" />
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 Koto.Infrastructure.Http --version 0.1.0-preview.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Koto.Infrastructure.Http, 0.1.0-preview.5"
#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 Koto.Infrastructure.Http@0.1.0-preview.5
#: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=Koto.Infrastructure.Http&version=0.1.0-preview.5&prerelease
#tool nuget:?package=Koto.Infrastructure.Http&version=0.1.0-preview.5&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Koto.Infrastructure.Http
Anti-Corruption Layer for synchronous HTTP calls between services. Part of the Koto suite.
Install
dotnet add package Koto.Infrastructure.Http
What's included
| Type | Purpose |
|---|---|
ServiceHttpClient |
Abstract base for typed HTTP clients; maps HTTP errors to Result<T> |
ICorrelationIdAccessor |
Interface for providing the current correlation ID |
CorrelationIdHandler |
Delegating handler that propagates X-Correlation-ID |
AddServiceHttpClient<TInterface, TImplementation>() |
Registers with standard resilience (retry + circuit breaker + timeout) |
Usage
1 — Define the application interface (no HTTP here)
// Application layer
public interface IPaymentService
{
Task<Result<PaymentId>> ChargeAsync(Money amount, CancellationToken ct);
}
2 — Implement with the HTTP client
// Infrastructure layer
public class PaymentServiceHttpClient : ServiceHttpClient, IPaymentService
{
public PaymentServiceHttpClient(HttpClient http) : base(http) { }
public async Task<Result<PaymentId>> ChargeAsync(Money amount, CancellationToken ct)
{
var response = await Http.PostAsJsonAsync("/charges",
new { Amount = amount.Amount, Currency = amount.Currency }, ct);
return await ReadResultAsync<PaymentId>(response, ct);
}
}
3 — Register
// Implement ICorrelationIdAccessor (typically wraps IHttpContextAccessor):
services.AddScoped<ICorrelationIdAccessor, HttpContextCorrelationIdAccessor>();
services.AddServiceHttpClient<IPaymentService, PaymentServiceHttpClient>(
name: "payment-service",
baseUrl: config["Services:Payment:BaseUrl"]!);
Standard resilience pipeline is applied automatically (3 retries with exponential back-off, circuit breaker, 30 s timeout).
Error mapping
| HTTP status | Error.Code |
|---|---|
| 404 | general.not-found |
| 409 | general.conflict |
| 422 | general.validation |
| 5xx | general.unexpected |
Override MapErrorResponse to add service-specific error codes.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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.
-
net10.0
- Koto.Domain (>= 0.1.0-preview.5)
- Microsoft.Extensions.Http.Resilience (>= 10.6.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0-preview.5 | 34 | 5/13/2026 |
| 0.1.0-preview.4 | 34 | 5/13/2026 |
| 0.1.0-preview.3 | 36 | 5/13/2026 |