Wednesday, May 1, 2019

Customizing Automatic HTTP 400 Error Response in ASP.NET Core Web APIs

Annotating the controllers with ApiController attribute in ASP .NET Core 2.1 or higher will enable the behavioral options for the API's. These behavioral options include automatic HTTP 400 responses as well.
In this post, we'll see how we can customize the default error response from the ASP .NET Core Web API.Image title

Default Error Response

If you are creating a new default ASP .NET Core web API project, then you'd see the ValuesController .cs file in the project. Otherwise, create a Controller and create an action method to a parameter to test the automatic HTTP 400 responses.



from DZone.com Feed http://bit.ly/2WdgfeY

No comments:

Post a Comment