title: ASP.NET Core return custom response when method is not allowed
body: <p>I'm using ASP.NET Core for building REST service</p>
  
  <p>I need to return custom response code if user tries to request an endpoint with unsupported method.
  For example endpoint localhost/api/test supports GET method only, but user requests it with POST method. I need to return 404 response and custom body.</p>
  
  <p>How to do this with ASP.NET Core?</p>
  
  <hr>
  
  <h2>UPD:</h2>
  
  <p>Possibly I formulated my question incorrectly.<br>
  I need ASP Core return 405 response code with custom JSON body in case if a method is not allowed. 
  This should be a standard behavior, but not implemented yet (according to this <a href="https://github.com/aspnet/Mvc/issues/388" rel="nofollow noreferrer">issue</a>)
  So I'm looking to workaround to return 405 response code nevertheless ASP Core does not support it out of box.</p>