How to Customize a Model Validation Response which results in an HTTP 400 Error Code?
Answers
Brian
2376
Points
13
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
|
Blog
Active User (0)
No Active User!