MCPcopy
hub / github.com/sveltejs/kit / method_not_allowed

Function method_not_allowed

packages/kit/src/runtime/server/utils.js:27–36  ·  view source on GitHub ↗
(mod, method)

Source from the content-addressed store, hash-verified

25 * @param {import('types').HttpMethod} method
26 */
27export 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 */
39export function allowed_methods(mod) {

Callers 2

resolveFunction · 0.90
render_endpointFunction · 0.90

Calls 2

textFunction · 0.90
allowed_methodsFunction · 0.85

Tested by

no test coverage detected