@hlw-uni-mp/request 1.0.10 → 1.0.12
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/dist/index.js +3 -3
- package/dist/index.mjs +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6933,7 +6933,7 @@ function buildHeader(cred, customHeader) {
|
|
|
6933
6933
|
const headers = { ...customHeader };
|
|
6934
6934
|
if (cred.type === "local") {
|
|
6935
6935
|
if (appid) headers["X-Appid"] = String(appid);
|
|
6936
|
-
if (token) headers["
|
|
6936
|
+
if (token) headers["token"] = String(token);
|
|
6937
6937
|
}
|
|
6938
6938
|
return headers;
|
|
6939
6939
|
}
|
|
@@ -6959,7 +6959,7 @@ function doUpload(cred, filePath, customHeader) {
|
|
|
6959
6959
|
}
|
|
6960
6960
|
try {
|
|
6961
6961
|
const body = typeof res.data === "string" ? JSON.parse(res.data) : res.data;
|
|
6962
|
-
body
|
|
6962
|
+
body.code === 1 ? resolve() : reject(new Error(body.msg || "\u4E0A\u4F20\u5931\u8D25"));
|
|
6963
6963
|
} catch {
|
|
6964
6964
|
reject(new Error("\u54CD\u5E94\u89E3\u6790\u5931\u8D25"));
|
|
6965
6965
|
}
|
|
@@ -7038,7 +7038,7 @@ function buildSecurityHeaders(config) {
|
|
|
7038
7038
|
headers["x-appid"] = String(devInfo.appid);
|
|
7039
7039
|
}
|
|
7040
7040
|
if (token) {
|
|
7041
|
-
headers["
|
|
7041
|
+
headers["token"] = token;
|
|
7042
7042
|
}
|
|
7043
7043
|
return headers;
|
|
7044
7044
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -6907,7 +6907,7 @@ function buildHeader(cred, customHeader) {
|
|
|
6907
6907
|
const headers = { ...customHeader };
|
|
6908
6908
|
if (cred.type === "local") {
|
|
6909
6909
|
if (appid) headers["X-Appid"] = String(appid);
|
|
6910
|
-
if (token) headers["
|
|
6910
|
+
if (token) headers["token"] = String(token);
|
|
6911
6911
|
}
|
|
6912
6912
|
return headers;
|
|
6913
6913
|
}
|
|
@@ -6933,7 +6933,7 @@ function doUpload(cred, filePath, customHeader) {
|
|
|
6933
6933
|
}
|
|
6934
6934
|
try {
|
|
6935
6935
|
const body = typeof res.data === "string" ? JSON.parse(res.data) : res.data;
|
|
6936
|
-
body
|
|
6936
|
+
body.code === 1 ? resolve() : reject(new Error(body.msg || "\u4E0A\u4F20\u5931\u8D25"));
|
|
6937
6937
|
} catch {
|
|
6938
6938
|
reject(new Error("\u54CD\u5E94\u89E3\u6790\u5931\u8D25"));
|
|
6939
6939
|
}
|
|
@@ -7012,7 +7012,7 @@ function buildSecurityHeaders(config) {
|
|
|
7012
7012
|
headers["x-appid"] = String(devInfo.appid);
|
|
7013
7013
|
}
|
|
7014
7014
|
if (token) {
|
|
7015
|
-
headers["
|
|
7015
|
+
headers["token"] = token;
|
|
7016
7016
|
}
|
|
7017
7017
|
return headers;
|
|
7018
7018
|
}
|
package/package.json
CHANGED