perf:新增onHttpError,发布版本1.0.6

This commit is contained in:
曾文豪
2023-03-17 13:16:03 +08:00
parent 8d7e311a46
commit 0677c72203
3 changed files with 5 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@tiesheng/npm-tool",
"version": "1.0.4",
"version": "1.0.5",
"description": "npm tool package",
"main": "index.js",
"scripts": {

View File

@@ -96,6 +96,7 @@ async function req(url, options) {
}
resolve(data)
} else {
GlobalConfig.getConfig().onHttpError(res);
reject(res)
}
})

View File

@@ -1,11 +1,13 @@
/**
* 默认配置
* @type {{prefix: string, encryptBody: boolean}}
* @type {{onHttpError: defaultConfig.onHttpError, prefix: string, base64Key: string, encryptBody: boolean}}
*/
const defaultConfig = {
encryptBody: true,
base64Key: "WmdUzPJXbngVNiaSsQrihg==",
prefix: "",
onHttpError: (res) => {
}
}
/**