N
N
Nikita Kudrin2021-02-23 19:57:43
Express.js
Nikita Kudrin, 2021-02-23 19:57:43

How to make a response to an unknown method?

How to make the user get a list of methods if the method he calls does not exist?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alex4answ, 2021-02-23
@HepkaPlay

405
HTTP protocol status code 405 Method Not Allowed, indicates that the request method is known to the server, but has been disabled and cannot be used. The two required methods GET and HEAD should never be disabled and should not return this error code.
The server MUST generate an Allow header field in a 405 response that contains a list of the resource's currently available methods.
PS doesn't express implement this out of the box?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question