HttpBuildR.ActionResult
3.1.0
See the version list below for details.
dotnet add package HttpBuildR.ActionResult --version 3.1.0
NuGet\Install-Package HttpBuildR.ActionResult -Version 3.1.0
<PackageReference Include="HttpBuildR.ActionResult" Version="3.1.0" />
paket add HttpBuildR.ActionResult --version 3.1.0
#r "nuget: HttpBuildR.ActionResult, 3.1.0"
// Install HttpBuildR.ActionResult as a Cake Addin #addin nuget:?package=HttpBuildR.ActionResult&version=3.1.0 // Install HttpBuildR.ActionResult as a Cake Tool #tool nuget:?package=HttpBuildR.ActionResult&version=3.1.0
HTTP BuildR ActionResult
Http BuildR ActionResult is a simple set of C# functions for building responses using ActionResult!
They are always typed (unlike the static action result builders in BaseController) and easy to build using the existing fluent API on-top HttpResponseMessage, with some added methods that make it easy on the happy and unhappy path.
Getting Started
To use this library, simply include HttpBuildR.ActionResult.dll
in your
project or grab it
from NuGet, and add
this to the top of each .cs
file that needs it:
using HttpBuildR;
using Resp = HttpStatusCode;
Then get building!,
using HttpBuildR;
// its helpful to alias this for readability
using Resp = HttpStatusCode;
...
// all types can be converted to ok responses
ActionResult<string> result = ActionResultBuilder.Ok("some content");
// non-ok responses can be built from response status codes
ActionResult<string> result = Resp.BadRequest
.Result()
// add some headers
.WithHeader("x-custom-header", "a","b","c")
// with some content, they are all supported!
.WithProblemDetails(new ProblemDetails(){...})
// only typed action results are supported
.ToActionResult<string>();
...
For more details/information have a look the test project or create an issue.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. 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 is compatible. 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. |
-
net6.0
- HttpBuildR.Response (>= 3.1.0)
-
net8.0
- HttpBuildR.Response (>= 3.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.