MCPcopy Create free account
hub / github.com/appium/appium / unknownMethodHandler

Function unknownMethodHandler

packages/http-server/lib/middleware/unknown-method.ts:12–22  ·  view source on GitHub ↗
(allowedMethods: string)

Source from the content-addressed store, hash-verified

10 * @param allowedMethods - Methods this command declares, for the `Allow` header on `HEAD`
11 */
12export function unknownMethodHandler(allowedMethods: string): RequestHandler {
13 return function rejectUnknownMethod(req: Request, res: Response): void {
14 if (req.method === 'HEAD') {
15 res.status(405).set('Allow', allowedMethods).set('Content-Type', 'application/json; charset=utf-8').end();
16 return;
17 }
18 log.debug(`Method ${req.method} is not supported for ${req.path}`);
19 const [status, body] = getResponseForW3CError(new errors.UnknownMethodError());
20 res.status(status).json(body);
21 };
22}

Callers 1

serverFunction · 0.85

Calls 5

getResponseForW3CErrorFunction · 0.90
setMethod · 0.80
jsonMethod · 0.80
debugMethod · 0.65
endMethod · 0.45

Tested by

no test coverage detected