This is a great feature, but sometimes you want to return the custom error instead of the 400 bad request error. This checks for the model state validity and returns the response accordingly. When the controller is decorated with APIController attribute, the framework would automatically register a ModelStateInvalidFilter which runs on the OnActionExecuting event. ASP.NET Core 2.1 introduced the APIController attribute which performs automatic model state validation and in case of an invalid model state, responds with a 400 bad request error.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |