Hlibz.Results.AspNetCore
2.0.0-preview.2
See the version list below for details.
dotnet add package Hlibz.Results.AspNetCore --version 2.0.0-preview.2
NuGet\Install-Package Hlibz.Results.AspNetCore -Version 2.0.0-preview.2
<PackageReference Include="Hlibz.Results.AspNetCore" Version="2.0.0-preview.2" />
<PackageVersion Include="Hlibz.Results.AspNetCore" Version="2.0.0-preview.2" />
<PackageReference Include="Hlibz.Results.AspNetCore" />
paket add Hlibz.Results.AspNetCore --version 2.0.0-preview.2
#r "nuget: Hlibz.Results.AspNetCore, 2.0.0-preview.2"
#:package Hlibz.Results.AspNetCore@2.0.0-preview.2
#addin nuget:?package=Hlibz.Results.AspNetCore&version=2.0.0-preview.2&prerelease
#tool nuget:?package=Hlibz.Results.AspNetCore&version=2.0.0-preview.2&prerelease
![]()
Hlibz.Results.AspNetCore
Turns Hlibz.Results into HTTP responses with one error body for every failure: from minimal API endpoints and controllers to the authorization gate's own 401/403 and anything your middleware writes.
dotnet add package Hlibz.Results.AspNetCore
builder.Services.AddResultErrorResponses();
builder.Services.AddErrorCodeCatalog(typeof(OrdersErrorCodes).Assembly);
app.MapPost("orders/{id:guid}/lines", async (Guid id, AddLine line, IOrderService orders) =>
(await orders.AddLineAsync(id, line)).ToHttpResult());
app.MapErrorCodes(); // GET api/error-codes → [{ "code": "orders_1001", "message": "..." }]
Or let handlers return a Result as is: app.MapGroup("/api/orders").WithResultResponses().
In a controller, ToActionResult() sends the same status codes and bodies.
| Status | HTTP (default) |
|---|---|
Success |
200 |
Error |
400 |
Invalid |
400 |
NotFound |
404 |
Unauthorized |
401 |
Forbidden |
403 |
Conflict |
409 |
Unavailable |
503 |
Every failure has this body (validation_errors only when there are any):
{ "message": "The order is closed.", "code": "orders_1001" }
Your code says what failed; the HTTP code is configuration (422 for Invalid, say).
Validation error keys follow your JSON naming policy per path segment: Items[0].UnitPrice →
items[0].unit_price under snake_case.
For clients that want one shape for every body, success included, there is an opt-in envelope
(ToEnvelopeHttpResult(), WithResultEnvelopes(), or your own shape), which can also be sent
as HTTP 200 always. The error code catalog publishes every code your app can return, per app if
you have several.
In a Native AOT app (reflection-based JSON off), add ErrorResponse, ResultEnvelope and the
ResultEnvelope<T>s you return to your JsonSerializerContext, or error responses fail with a
500.
Related packages
- Hlibz.Results: the
Resulttypes. - Hlibz.Results.FluentValidation:
a failed validation as
Result.Invalid. - Hlibz.MinimalApi.Endpoints: minimal API endpoints as classes; their handlers return results the same way.
Full documentation and samples: github.com/hlib-zinchenko/Hlibz.Results.
| 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. net11.0 is compatible. |
-
net10.0
- Hlibz.Results (>= 2.0.0-preview.2)
-
net11.0
- Hlibz.Results (>= 2.0.0-preview.2)
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 |
|---|---|---|
| 2.0.0 | 56 | 11/18/2026 |
| 2.0.0-preview.4 | 65 | 11/14/2026 |
| 2.0.0-preview.3 | 49 | 11/14/2026 |
| 2.0.0-preview.2 | 60 | 11/13/2026 |
| 2.0.0-preview.1 | 58 | 11/13/2026 |
| 1.1.0 | 109 | 11/12/2026 |
| 1.0.0 | 92 | 11/11/2026 |