express-allow-methods
Version:
Express middleware for sending HTTP 405 Method Not Allowed response
53 lines (52 loc) • 2.96 kB
TypeScript
/**
* @public
* All the methods that are listed in Node.JS's `require("http").METHODS` (as of Node.JS v16.0.0).
* See [Node.JS's source code](https://github.com/nodejs/node/blob/bfee9daaa59d8b7598e588ac3e75b690378d3dfb/deps/llhttp/include/llhttp.h#L121-L168) and a [unit test file](https://github.com/nodejs/node/blob/bfee9daaa59d8b7598e588ac3e75b690378d3dfb/test/parallel/test-http-methods.js#L30-L66) on GitHub for reference.
*/
declare namespace HttpMethod {
/** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET) */
type GET = "GET";
/** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST) */
type POST = "POST";
/** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PUT) */
type PUT = "PUT";
/** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PATCH) */
type PATCH = "PATCH";
/** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/DELETE) */
type DELETE = "DELETE";
/** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD) */
type HEAD = "HEAD";
/** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/OPTIONS) */
type OPTIONS = "OPTIONS";
/** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/CONNECT) */
type CONNECT = "CONNECT";
/** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/TRACE) */
type TRACE = "TRACE";
type ACL = "ACL";
type BIND = "BIND";
type CHECKOUT = "CHECKOUT";
type COPY = "COPY";
type LINK = "LINK";
type LOCK = "LOCK";
type MERGE = "MERGE";
type MKACTIVITY = "MKACTIVITY";
type MKCALENDAR = "MKCALENDAR";
type MKCOL = "MKCOL";
type MOVE = "MOVE";
type NOTIFY = "NOTIFY";
type PRI = "PRI";
type PROPFIND = "PROPFIND";
type PROPPATCH = "PROPPATCH";
type PURGE = "PURGE";
type REBIND = "REBIND";
type REPORT = "REPORT";
type SEARCH = "SEARCH";
type SOURCE = "SOURCE";
type SUBSCRIBE = "SUBSCRIBE";
type UNBIND = "UNBIND";
type UNLINK = "UNLINK";
type UNLOCK = "UNLOCK";
type UNSUBSCRIBE = "UNSUBSCRIBE";
}
declare type HttpMethod = HttpMethod.GET | HttpMethod.POST | HttpMethod.PUT | HttpMethod.PATCH | HttpMethod.DELETE | HttpMethod.HEAD | HttpMethod.OPTIONS | HttpMethod.CONNECT | HttpMethod.TRACE | HttpMethod.ACL | HttpMethod.BIND | HttpMethod.CHECKOUT | HttpMethod.COPY | HttpMethod.LINK | HttpMethod.LOCK | HttpMethod.MERGE | HttpMethod.MKACTIVITY | HttpMethod.MKCALENDAR | HttpMethod.MKCOL | HttpMethod.MOVE | HttpMethod.NOTIFY | HttpMethod.PRI | HttpMethod.PROPFIND | HttpMethod.PROPPATCH | HttpMethod.PURGE | HttpMethod.REBIND | HttpMethod.REPORT | HttpMethod.SEARCH | HttpMethod.SOURCE | HttpMethod.SUBSCRIBE | HttpMethod.UNBIND | HttpMethod.UNLINK | HttpMethod.UNLOCK | HttpMethod.UNSUBSCRIBE;
export default HttpMethod;