uniapp-request-sdk 1.4.10 → 1.4.11
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.esm.js +11 -1
- package/dist/index.umd.js +11 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -157,7 +157,17 @@ var UniRequest = /*#__PURE__*/function () {
|
|
|
157
157
|
data = resData.data;
|
|
158
158
|
if (statusCode === 200) {
|
|
159
159
|
if (!data.errno) {
|
|
160
|
-
|
|
160
|
+
var jsonData = data;
|
|
161
|
+
/** 如果是上传API的话,返回的结果需要解析成json对象 */
|
|
162
|
+
if (Object.prototype.toString.call(data) !== '[object Object]' && callbackPromise === uploadFilePromise) {
|
|
163
|
+
try {
|
|
164
|
+
jsonData = JSON.parse(data);
|
|
165
|
+
} catch (error) {
|
|
166
|
+
console.error(error);
|
|
167
|
+
_this3.rejectHandler(rej, resData);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
res(jsonData.data);
|
|
161
171
|
} else {
|
|
162
172
|
_this3.rejectHandler(rej, resData);
|
|
163
173
|
}
|
package/dist/index.umd.js
CHANGED
|
@@ -163,7 +163,17 @@
|
|
|
163
163
|
data = resData.data;
|
|
164
164
|
if (statusCode === 200) {
|
|
165
165
|
if (!data.errno) {
|
|
166
|
-
|
|
166
|
+
var jsonData = data;
|
|
167
|
+
/** 如果是上传API的话,返回的结果需要解析成json对象 */
|
|
168
|
+
if (Object.prototype.toString.call(data) !== '[object Object]' && callbackPromise === uploadFilePromise) {
|
|
169
|
+
try {
|
|
170
|
+
jsonData = JSON.parse(data);
|
|
171
|
+
} catch (error) {
|
|
172
|
+
console.error(error);
|
|
173
|
+
_this3.rejectHandler(rej, resData);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
res(jsonData.data);
|
|
167
177
|
} else {
|
|
168
178
|
_this3.rejectHandler(rej, resData);
|
|
169
179
|
}
|