(mod, method)
| 25 | * @param {import('types').HttpMethod} method |
| 26 | */ |
| 27 | export function method_not_allowed(mod, method) { |
| 28 | return text(`${method} method not allowed`, { |
| 29 | status: 405, |
| 30 | headers: { |
| 31 | // https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405 |
| 32 | // "The server must generate an Allow header field in a 405 status code response" |
| 33 | allow: allowed_methods(mod).join(', ') |
| 34 | } |
| 35 | }); |
| 36 | } |
| 37 | |
| 38 | /** @param {Partial<Record<import('types').HttpMethod, any>>} mod */ |
| 39 | export function allowed_methods(mod) { |
no test coverage detected