1

How are you, people I need to change the response message of the return of BadRequest().

When I use the request like this, BadResquest("error: you can not pass these values")

I want to my api return something like this:

{"error: you can not pass these values"} 

but the endpoint retuned this :

{"Message":"error: you can not pass these values"}

I don't want the word "Message" in my response, is there any form to overwrite or change the response?.

ernesto petit
  • 1,436
  • 1
  • 14
  • 19

1 Answers1

0

You're free to create what ever response message you like. see http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/action-results

The BadRequest() helper method is just that. It's a workload reduction method that takes care of boilerplate stuff.

Nethemas
  • 136
  • 1
  • 9