Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

add isArray to cap validation strategies #314

Merged
merged 2 commits into from
Apr 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lib/basedriver/desired-caps.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`);
Expand Down
1 change: 1 addition & 0 deletions lib/jsonwp-proxy/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down