mirror of
https://github.com/appium/appium.git
synced 2026-10-25 18:21:19 +08:00
Proper length handling
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user