Created
December 17, 2020 21:51
-
-
Save kid-cavaquinho/0692ce8b5ed5d71e2b0db5efce0a693f to your computer and use it in GitHub Desktop.
https://tools.ietf.org/html/rfc7807 custom ApiBehaviorOptions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| services.Configure<ApiBehaviorOptions>(options => | |
| { | |
| options.InvalidModelStateResponseFactory = actionContext => | |
| { | |
| var problemDetails = new ValidationProblemDetails | |
| { | |
| Detail = "For big problem!", | |
| Title = "Get a big localized solution!", | |
| }; | |
| return new BadRequestObjectResult(problemDetails); | |
| }; | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment