MCPcopy
hub / github.com/appium/appium / requestToCommandName

Method requestToCommandName

lib/jsonwp-proxy/proxy.js:240–253  ·  view source on GitHub ↗
(url, method)

Source from the content-addressed store, hash-verified

238 }
239
240 requestToCommandName (url, method) {
241 const extractCommandName = (pattern) => {
242 const pathMatch = pattern.exec(url);
243 return pathMatch ? routeToCommandName(pathMatch[1], method, this.reqBasePath) : null;
244 };
245 let commandName = routeToCommandName(url, method, this.reqBasePath);
246 if (!commandName && _.includes(url, `${this.reqBasePath}/session/`)) {
247 commandName = extractCommandName(new RegExp(`${_.escapeRegExp(this.reqBasePath)}/session/[^/]+(.+)`));
248 }
249 if (!commandName && _.includes(url, this.reqBasePath)) {
250 commandName = extractCommandName(new RegExp(`${_.escapeRegExp(this.reqBasePath)}(/.+)`));
251 }
252 return commandName;
253 }
254
255 async proxyCommand (url, method, body = null) {
256 const commandName = this.requestToCommandName(url, method);

Callers 1

proxyCommandMethod · 0.95

Calls 1

routeToCommandNameFunction · 0.90

Tested by

no test coverage detected