youzanyun-sdk-nodejs
Advanced tools
Comparing version 2.0.0-beta.16 to 2.0.0-beta.17
@@ -132,8 +132,12 @@ "use strict"; | ||
code, | ||
data | ||
data, | ||
gw_err_resp | ||
} = response.data || {}; | ||
const { | ||
err_code | ||
} = gw_err_resp || {}; | ||
if (CODE_SUCCESS.includes(+code)) { | ||
resolve(data); | ||
} else if (CODE_INVALID.includes(+code) && config.retryCount <= MAX_RETRIES.TOKEN_INVALID) { | ||
} else if (CODE_INVALID.includes(+err_code) && config.retryCount <= MAX_RETRIES.TOKEN_INVALID) { | ||
// 重试请求 | ||
@@ -140,0 +144,0 @@ request(); |
"use strict"; | ||
module.exports = { | ||
CODE_SUCCESS: [0, 200], | ||
CODE_SUCCESS: [200], | ||
// 响应成功 | ||
@@ -6,0 +6,0 @@ CODE_INVALID: [4201, // 非法的请求凭证 |
{ | ||
"name": "youzanyun-sdk-nodejs", | ||
"version": "2.0.0-beta.16", | ||
"version": "2.0.0-beta.17", | ||
"description": "有赞云 nodejs sdk", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -83,6 +83,11 @@ const TokenService = require('./token'); | ||
this.logger.info('dktest-success', response); | ||
const { code, data } = response.data || {}; | ||
const { code, data, gw_err_resp } = response.data || {}; | ||
const { err_code } = gw_err_resp || {}; | ||
if (CODE_SUCCESS.includes(+code)) { | ||
resolve(data); | ||
} else if (CODE_INVALID.includes(+code) && config.retryCount <= MAX_RETRIES.TOKEN_INVALID) { | ||
} else if ( | ||
CODE_INVALID.includes(+err_code) && | ||
config.retryCount <= MAX_RETRIES.TOKEN_INVALID | ||
) { | ||
// 重试请求 | ||
@@ -89,0 +94,0 @@ request(); |
module.exports = { | ||
CODE_SUCCESS: [0, 200], // 响应成功 | ||
CODE_SUCCESS: [200], // 响应成功 | ||
CODE_INVALID: [ | ||
@@ -4,0 +4,0 @@ 4201, // 非法的请求凭证 |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35108
1086