I was just testing a new POST method, and I accidentally sent an unauthorized GET request, and the response I got was:
"message": "The requested resource does not support http method 'GET'."
But when I sent a POST request, I got this response:
"message": "Authorization has been denied for this request."
Shouldn't I be getting the unauthorized message no matter what I do if I'm not authorized or even authenticated?
Here's the method:
[Route("api/search"), HttpPost, Authorize]
public async Task<IHttpActionResult> Search()
{
...
}
I have tried decorating the controller, and the method with the [Authorize]
attribute, and I have a global filter set as well.