How to Customize a Model Validation Response which results in an HTTP 400 Error Code?
Answers
Brian
2232
Points
14
Posts
|
As per documentation: automatic-http-400-responses , the [ApiController] attribute makes model validation errors automatically trigger an HTTP 400 response. Consequently, the following code is unnecessary in an action method:
You can disable the automatic 400 behavior by seting the SuppressModelStateInvalidFilter property to true. Add the following code in Startup.ConfigureServices:
Posted On:
13-Jul-2021 00:03
great.. - Rahul Maurya 12-Mar-2023 02:10
|