@tmsfe/tms-core 0.0.146 → 0.0.147
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/request.js +0 -11
package/package.json
CHANGED
package/src/request.js
CHANGED
|
@@ -381,7 +381,6 @@ export default class Request {
|
|
|
381
381
|
encryptObj.updateDecryptKey(res.data.resData);
|
|
382
382
|
} catch (e) {
|
|
383
383
|
encryptObj.updateDecryptKey(null);
|
|
384
|
-
logger.log('tms-performance-log', 'request_encrypt_log', 'main', 'refresh_encrypt_key_false', e);
|
|
385
384
|
}
|
|
386
385
|
}
|
|
387
386
|
|
|
@@ -478,7 +477,6 @@ export default class Request {
|
|
|
478
477
|
header: encryptHeader, data: encryptData, aesKey,
|
|
479
478
|
} = encryptObj.reqEncrypt(method, data, header, '');
|
|
480
479
|
// 2. 发送请求
|
|
481
|
-
logger.log('tms-performance-log', 'request_encrypt_log', 'main', 'send_encrypt_request', seqId, '', '', path);
|
|
482
480
|
const result = await this.wxRequest(finalUrl, method, encryptHeader, encryptData, false, seqId);
|
|
483
481
|
const { header: resHeader, data: resData } = result;
|
|
484
482
|
// 3. 解密响应
|
|
@@ -487,14 +485,9 @@ export default class Request {
|
|
|
487
485
|
reporter.reportPerformance('request_encrypt_log', 'main', 'local_response_decrypt_fail', seqId);
|
|
488
486
|
return this.createRequestTask(path, param, method, header, false);
|
|
489
487
|
}
|
|
490
|
-
logger.log('tms-performance-log', 'request_encrypt_log', 'main', 'decrypt_response_success', seqId);
|
|
491
488
|
// 4. 处理解密失败的响应
|
|
492
489
|
const errCodeType = encryptObj.getErrcodeType(decryptData.errCode, decryptData.errMsg);
|
|
493
490
|
if (errCodeType === encryptObj.reqErrType.pubKeyInvalid) { // 秘钥失效
|
|
494
|
-
logger.log(
|
|
495
|
-
'tms-performance-log', 'request_encrypt_log', 'main', 'remote_response_decrypt_fail',
|
|
496
|
-
seqId, decryptData.errCode, retryTimes,
|
|
497
|
-
);
|
|
498
491
|
const encryptSwitch = await this.dealEncryptionSwitch(resHeader, true);
|
|
499
492
|
if (retryTimes > 2) {
|
|
500
493
|
throw new Error('解密失败,请重试');
|
|
@@ -502,10 +495,6 @@ export default class Request {
|
|
|
502
495
|
return this.createRequestTask(path, param, method, header, encryptSwitch, retryTimes + 1);
|
|
503
496
|
}
|
|
504
497
|
if (errCodeType === encryptObj.reqErrType.decryptError) { // 解密失败
|
|
505
|
-
logger.log(
|
|
506
|
-
'tms-performance-log', 'request_encrypt_log', 'main', 'remote_response_decrypt_fail',
|
|
507
|
-
seqId, decryptData.errCode, retryTimes,
|
|
508
|
-
);
|
|
509
498
|
return this.createRequestTask(path, param, method, header, false);
|
|
510
499
|
}
|
|
511
500
|
if (errCodeType === encryptObj.reqErrType.cryptoDisabled) { // 加密关闭
|