From 009602ce56db8f402577f4e20f7156c795f97570 Mon Sep 17 00:00:00 2001 From: Jonathan Lipps Date: Thu, 4 Apr 2019 07:52:40 -0700 Subject: [PATCH 1/2] add isArray to the cap validation strategies --- lib/basedriver/desired-caps.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/basedriver/desired-caps.js b/lib/basedriver/desired-caps.js index 112a0ca26..a95dafb51 100755 --- a/lib/basedriver/desired-caps.js +++ b/lib/basedriver/desired-caps.js @@ -109,6 +109,17 @@ validator.validators.isObject = function isObject (value) { return 'must be of type object'; }; +validator.validators.isArray = function isArray (value) { + if (Array.isArray(value)) { + return null; + } + + if (typeof value === 'undefined') { + return null; + } + + return 'must be of type array'; +}; validator.validators.deprecated = function deprecated (value, options, key) { if (options) { log.warn(`${key} is a deprecated capability`); From 2fd5db2a345c9e0ea78573c9964c553d9d05ca5d Mon Sep 17 00:00:00 2001 From: Jonathan Lipps Date: Thu, 4 Apr 2019 07:53:31 -0700 Subject: [PATCH 2/2] add some logging to help follow proxy protocol translation logic --- lib/jsonwp-proxy/proxy.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/jsonwp-proxy/proxy.js b/lib/jsonwp-proxy/proxy.js index 6c23b7d1c..029e71594 100644 --- a/lib/jsonwp-proxy/proxy.js +++ b/lib/jsonwp-proxy/proxy.js @@ -159,6 +159,7 @@ class JWProxy { const resBodyObj = util.safeJsonParse(resBody); if (!this.downstreamProtocol) { this.downstreamProtocol = this.getProtocolFromResBody(resBodyObj); + log.debug(`Determined that the downstream protocol for proxy is ${this.downstreamProtocol}`); } if (res.statusCode < 400 && this.downstreamProtocol === MJSONWP && parseInt(resBodyObj.status, 10) !== 0) { // Some servers, like chromedriver may return response code 200 for non-zero JSONWP statuses