Skip to content

Commit 133738f

Browse files
fix: Pass reqBasePath option to the proxy (#129)
1 parent 3c4ad18 commit 133738f

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

lib/driver.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ export class GeckoDriver extends BaseDriver {
6868
/** @type {import('@appium/types').StringRecord | null} */
6969
let response = null;
7070
try {
71-
response = await this.gecko.start(formatCapsForServer(caps));
71+
response = await this.gecko.start(formatCapsForServer(caps), {
72+
reqBasePath: this.basePath,
73+
});
7274
} catch (e) {
7375
await this.deleteSession();
7476
throw e;

lib/gecko.js

+13-3
Original file line numberDiff line numberDiff line change
@@ -194,18 +194,23 @@ export class GeckoDriverServer {
194194
/**
195195
*
196196
* @param {import('@appium/types').StringRecord} geckoCaps
197+
* @param {SessionOptions} [opts={}]
197198
* @returns {Promise<import('@appium/types').StringRecord>}
198199
*/
199-
async start (geckoCaps) {
200+
async start (geckoCaps, opts = {}) {
200201
await this.process.init();
201202

202-
this.proxy = new GeckoProxy({
203+
const proxyOpts = {
203204
server: GECKO_SERVER_HOST,
204205
port: this.process.port,
205206
log: this.log,
206207
base: '',
207208
keepAlive: true,
208-
});
209+
};
210+
if (opts.reqBasePath) {
211+
proxyOpts.reqBasePath = opts.reqBasePath;
212+
}
213+
this.proxy = new GeckoProxy(proxyOpts);
209214
this.proxy.didProcessExit = false;
210215
this.process?.proc?.on('exit', () => {
211216
if (this.proxy) {
@@ -277,3 +282,8 @@ export class GeckoDriverServer {
277282
}
278283

279284
export default GeckoDriverServer;
285+
286+
/**
287+
* @typedef {Object} SessionOptions
288+
* @property {string} [reqBasePath]
289+
*/

0 commit comments

Comments
 (0)