perf:增加rawResponse属性,返回原始的数据
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@tiesheng/npm-tool",
|
"name": "@tiesheng/npm-tool",
|
||||||
"version": "1.0.11",
|
"version": "1.0.12",
|
||||||
"description": "npm tool package",
|
"description": "npm tool package",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -92,6 +92,9 @@ async function req(url, options) {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
if (options.rawResponse) {
|
||||||
|
resolve(res);
|
||||||
|
} else {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
let data = res.data;
|
let data = res.data;
|
||||||
if (res.encrypt) {
|
if (res.encrypt) {
|
||||||
@@ -103,6 +106,7 @@ async function req(url, options) {
|
|||||||
GlobalConfig.getConfig().onHttpError(res);
|
GlobalConfig.getConfig().onHttpError(res);
|
||||||
reject(res)
|
reject(res)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
reject({code: err.data.status, message: err.data.error});
|
reject({code: err.data.status, message: err.data.error});
|
||||||
|
|||||||
Reference in New Issue
Block a user