UNPKG

appium-webdriveragent

Version:
20 lines (17 loc) 576 B
import {JWProxy} from '@appium/base-driver'; import type {ProxyOptions} from '@appium/types'; export class NoSessionProxy extends JWProxy { constructor(opts: ProxyOptions = {}) { super(opts); } override getUrlForProxy(url: string): string { if (url === '') { url = '/'; } const proxyBase = `${this.scheme}://${this.server}:${this.port}${this.base}`; if (new RegExp('^/').test(url)) { return proxyBase + url.replace(/\/$/, ''); // can't have trailing slashes } throw new Error(`Did not know what to do with url '${url}'`); } }