Knight.Response.Abstractions.Http
2.0.0-preview01
dotnet add package Knight.Response.Abstractions.Http --version 2.0.0-preview01
NuGet\Install-Package Knight.Response.Abstractions.Http -Version 2.0.0-preview01
<PackageReference Include="Knight.Response.Abstractions.Http" Version="2.0.0-preview01" />
<PackageVersion Include="Knight.Response.Abstractions.Http" Version="2.0.0-preview01" />
<PackageReference Include="Knight.Response.Abstractions.Http" />
paket add Knight.Response.Abstractions.Http --version 2.0.0-preview01
#r "nuget: Knight.Response.Abstractions.Http, 2.0.0-preview01"
#:package Knight.Response.Abstractions.Http@2.0.0-preview01
#addin nuget:?package=Knight.Response.Abstractions.Http&version=2.0.0-preview01&prerelease
#tool nuget:?package=Knight.Response.Abstractions.Http&version=2.0.0-preview01&prerelease
Knight.Response.Abstractions.Http
Cross‑framework abstractions for HTTP result handling in the Knight.Response family.
This package collects the shared contracts and options that both
Knight.Response.AspNetCore
(for modern ASP.NET Core / minimal APIs), andKnight.Response.AspNetCore.Mvc
(for legacy ASP.NET Core MVC 2.x / .NET Framework scenarios)
use to keep behavior consistent.
Target frameworks: .NET Standard 2.0 (works with .NET Framework 4.7.1+ and .NET Core/.NET 6+).
What’s inside
KnightResponseBaseOptions<TH, TProblem, TValidation>
Base options class that centralizes:UseProblemDetails
(default:false
)UseValidationProblemDetails
(default:false
)IncludeFullResultPayload
(default:false
, wastrue
before 2.0.0-preview01)IncludeExceptionDetails
(default:false
)StatusCodeResolver
delegate- Optional builders/hooks for shaping problem responses
The generic parameters let each integration plug in the framework’s own HttpContext type (
TH
),ProblemDetails
type (TProblem
), andValidationProblemDetails
type (TValidation
) without duplication.Validation error mapping
IValidationErrorMapper
— abstraction for converting domainMessage
s into aDictionary<string,string[]>
suitable for validation problems.- Consumers are expected to register their own mapper in DI.
If none is provided, integrations will fall back to the built‑in
DefaultValidationErrorMapper
at runtime.
Install
dotnet add package Knight.Response.Abstractions.Http
You typically won’t reference this directly in application code; it’s a transitive dependency of the ASP.NET/MVC integration packages. It’s useful if you’re building your own integration and want to align with Knight.Response conventions.
Quick example (custom mapper)
using Knight.Response.Abstractions.Http.Mappers;
public sealed class MyValidationMapper : IValidationErrorMapper
{
public IDictionary<string, string[]> Map(IReadOnlyList<Message> messages)
=> new Dictionary<string, string[]> { ["name"] = new[] { "is required" } };
}
Register this type in the DI container of your chosen integration package
(e.g., Knight.Response.AspNetCore
or Knight.Response.Mvc
).
Related packages
Knight.Response
— immutableResult
/Result<T>
core library.Knight.Response.AspNetCore
— modern ASP.NET Core + minimal APIs integration.Knight.Response.AspNetCore.Mvc
— ASP.NET Core MVC 2.x / .NET Framework–friendly integration.
License
This project is licensed under the MIT License.
Contributing
Contributions are welcome! Please read CONTRIBUTING.md.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Knight.Response (>= 2.0.0-preview03)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Knight.Response.Abstractions.Http:
Package | Downloads |
---|---|
Knight.Response.AspNetCore
ASP.NET Core helpers for Knight.Response: map Result/Result<T> to IResult/ActionResult with consistent HTTP semantics. |
|
Knight.Response.Mvc
ASP.NET MVC / Web API 2 adapters for Knight.Response — convert Result/Result<T> to IActionResult/IHttpActionResult with optional RFC7807 ProblemDetails. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
2.0.0-preview01 | 0 | 9/24/2025 |
1.0.2 | 321 | 9/1/2025 |
1.0.1 | 244 | 8/28/2025 |
1.0.0 | 171 | 8/28/2025 |
Changed:
- Updated dependency to **Knight.Response 2.0.0-preview03**.
- Defaults are now opt-in:
• UseProblemDetails = false
• UseValidationProblemDetails = false
• IncludeFullResultPayload = false (was true before 2.0.0-preview01)
• IncludeExceptionDetails = false
- Validation error mapper resolution moved to runtime in consuming integrations.
Removed:
- Mapper is no longer pre-bound during options configuration.
Breaking changes:
- Default payload shaping has changed: full Result/Result<T> payloads are not included on success unless explicitly enabled.
- Validation mapper must now be registered by the consumer or the integration will fall back to DefaultValidationErrorMapper at runtime.