Merge pull request #314 from appium/jlipps/misc

add isArray to cap validation strategies
This commit is contained in:
Jonathan Lipps
2019-04-04 09:53:47 -07:00
committed by GitHub
2 changed files with 12 additions and 0 deletions
+11
View File
@@ -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`);
+1
View File
@@ -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