MadEyeMatt.AspNetCore.ProblemDetails 8.0.3

dotnet add package MadEyeMatt.AspNetCore.ProblemDetails --version 8.0.3
NuGet\Install-Package MadEyeMatt.AspNetCore.ProblemDetails -Version 8.0.3
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="MadEyeMatt.AspNetCore.ProblemDetails" Version="8.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MadEyeMatt.AspNetCore.ProblemDetails --version 8.0.3
#r "nuget: MadEyeMatt.AspNetCore.ProblemDetails, 8.0.3"
#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.
// Install MadEyeMatt.AspNetCore.ProblemDetails as a Cake Addin
#addin nuget:?package=MadEyeMatt.AspNetCore.ProblemDetails&version=8.0.3

// Install MadEyeMatt.AspNetCore.ProblemDetails as a Cake Tool
#tool nuget:?package=MadEyeMatt.AspNetCore.ProblemDetails&version=8.0.3

AspNetCore.ProblemDetails

A middleware to create RFC 7807 problem details for APIs.

Usage

To configute the mandatory services for the problem details middleware just execute AddProblemDetails on the IMvcBuilder instance in your startup code.

WebApplicationBuilder builder = WebApplication.CreateBuilder(args);

// Add services to the container.
builder.Services
	.AddControllers()
	.AddProblemDetails(options =>
	{
		// Only include exception details in a development environment. This is the default
		// behavior and is included to demo purposes.
		options.IncludeExceptionDetails = (context, exception) => builder.Environment.IsDevelopment();

		// Use the status code 501 for this type of exception.
		options.MapStatusCode<NotImplementedException>(HttpStatusCode.NotImplemented);

		// Use the status code 501 for this type of exception.
		options.MapStatusCode<InvalidOperationException>(HttpStatusCode.InternalServerError);

		// Add a fallback for all other exceptions with the status code 500.
		options.MapStatusCode<Exception>(HttpStatusCode.InternalServerError);
	});

After you've built your web application instance add the middlware to the pipeline by calling UseProblemDetails.

WebApplication app = builder.Build();

// Configure the HTTP request pipeline.			
app.UseCors();
app.UseProblemDetails();
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();
Product 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 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on MadEyeMatt.AspNetCore.ProblemDetails:

Package Downloads
Fluxera.Extensions.Hosting.Modules.AspNetCore.HttpApi The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

A module that enables HTTP APIs for ASP.NET Core.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
8.0.3 15 4/18/2024
8.0.2 188 3/19/2024
8.0.1 529 11/24/2023
8.0.0 150 11/16/2023
7.2.0 489 3/22/2023
7.1.0 465 1/18/2023
7.0.0 622 11/20/2022
6.2.0 614 10/12/2022
6.1.1 1,697 6/7/2022
6.1.0 389 6/4/2022
6.0.1 412 5/10/2022
6.0.0 402 5/7/2022