From 76efb2428fa94abfe4de656716bfac5e6b00092f Mon Sep 17 00:00:00 2001 From: Isaac Murchie Date: Mon, 17 Oct 2016 14:04:44 -0400 Subject: [PATCH] Proper length handling --- lib/jsonwp-proxy/proxy.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/jsonwp-proxy/proxy.js b/lib/jsonwp-proxy/proxy.js index 2f67030d0..b0ff93f59 100644 --- a/lib/jsonwp-proxy/proxy.js +++ b/lib/jsonwp-proxy/proxy.js @@ -1,3 +1,4 @@ +// jshint ignore: start import _ from 'lodash'; import { getLogger } from 'appium-logger'; import { util } from 'appium-support'; @@ -108,12 +109,12 @@ class JWProxy { } log.info(`Proxying [${method} ${url || "/"}] to [${method} ${newUrl}] ` + - (body ? `with body: ${_.truncate(JSON.stringify(body), LOG_LENGTH)}` : 'with no body')); + (body ? `with body: ${_.truncate(JSON.stringify(body), {length: LOG_LENGTH})}` : 'with no body')); let res, resBody; try { res = await this.request(reqOpts); resBody = res.body; - log.info(`Got response with status ${res.statusCode}: ${_.truncate(JSON.stringify(resBody), LOG_LENGTH)}`); + log.info(`Got response with status ${res.statusCode}: ${_.truncate(JSON.stringify(resBody), {length: LOG_LENGTH})}`); if (/\/session$/.test(url) && method === 'POST') { if (res.statusCode === 200) { this.sessionId = resBody.sessionId;