Skip to content

Commit a0357bb

Browse files
authoredFeb 21, 2025··
fix: Accept reqBasePath proxy option (#137)
1 parent 517be78 commit a0357bb

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed
 

‎lib/driver.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ export class SafariDriver extends BaseDriver {
6969
const [sessionId, caps] = await super.createSession(...args);
7070
this.safari = new SafariDriverServer(this.log);
7171
try {
72-
await this.safari.start(formatCapsForServer(caps));
72+
await this.safari.start(formatCapsForServer(caps), {
73+
reqBasePath: this.basePath,
74+
});
7375
} catch (e) {
7476
await this.deleteSession();
7577
throw e;

‎lib/safari.js

+17-3
Original file line numberDiff line numberDiff line change
@@ -115,16 +115,25 @@ export class SafariDriverServer {
115115
return !!(SAFARI_DRIVER_PROCESS.isRunning);
116116
}
117117

118-
async start (caps) {
118+
/**
119+
*
120+
* @param {import('@appium/types').StringRecord} caps
121+
* @param {SessionOptions} [opts={}]
122+
*/
123+
async start (caps, opts = {}) {
119124
await SAFARI_DRIVER_PROCESS.init();
120125

121-
this.proxy = new SafariProxy({
126+
const proxyOptions = {
122127
server: '127.0.0.1',
123128
port: SAFARI_DRIVER_PROCESS.port,
124129
base: '',
125130
log: this.log,
126131
keepAlive: true,
127-
});
132+
};
133+
if (opts.reqBasePath) {
134+
proxyOptions.reqBasePath = opts.reqBasePath;
135+
}
136+
this.proxy = new SafariProxy(proxyOptions);
128137
this.proxy.didProcessExit = false;
129138
SAFARI_DRIVER_PROCESS.proc?.on('exit', () => {
130139
if (this.proxy) {
@@ -185,3 +194,8 @@ export class SafariDriverServer {
185194
}
186195

187196
export default SafariDriverServer;
197+
198+
/**
199+
* @typedef {Object} SessionOptions
200+
* @property {string} [reqBasePath]
201+
*/

0 commit comments

Comments
 (0)
Please sign in to comment.