As of now, the Web api application returns the below response body for 405 - Method Not Allowed error. I am trying to change the response body, but I don't know how the delegating handler, ApiControllerActionSelector or filter can be used. Can anyone help me on catching the 405 error in server side?
{
message: "The requested resource does not support http method 'GET'."
}
Note: My api controllers has [RoutePrefix] value.
You could use a DelegatingHandler to catch the outgoing response and override its behaviour like this.
In Global.asax...