feat: allow plugins to avoid proxying certain routes
MODIFY
lib/appium.js
lib/appium.js
@@ -506,6 +506,23 @@ class AppiumDriver extends BaseDriver {
return res;
}
+ // We want to override basedriver's proxy avoidance detection since plugins might want to avoid
+ // proxying in order to handle a command, so we use this function to make an extra check whether
+ // plugins might want to do this.
+ proxyRouteIsAvoided (sessionId, method, url, body) {
+ if (super.proxyRouteIsAvoided(sessionId, method, url, body)) {
+ return true;
+ }
+ // if even just one plugin needs to avoid proxying, do so
+ for (const plugin of this.plugins) {
+ if (plugin.shouldAvoidProxy?.(method, url, body)) {
+ log.info(`Request to ${url} would normally be proxied, but plugin ${plugin.name} wants ` +
+ `to handle it internally. We'll avoid proxying in this case.`);
+ return true;
+ }
+ }
+ return false;
+ }
proxyActive (sessionId) {
const dstSession = this.sessions[sessionId];

feat: allow plugins to avoid proxying certain routes