Proper length handling

This commit is contained in:
Isaac Murchie
2016-10-17 14:04:44 -04:00
parent 2c3d7b4f56
commit 76efb2428f
+3 -2
View File
@@ -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;