'HTTP response status for unknown (nonexistent) HTTP method

Let's say I've got route /posts. It only implements GET HTTP method.

If someone tries to access it with different, existing method (POST, PUT, etc.) I return 405.

What should I return in case someone tries using some unsupported, nonexistent method like MYCUSTOMMETHOD or SFASFS? 405 method not allowed or rather 501 not implemented or maybe even 400 bad request (seems to be default behaviour in node express) , as such methods are not in HTTP specs?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source