uniapp-request-sdk 1.4.10 → 1.4.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.esm.js +12 -2
- package/dist/index.umd.js +12 -2
- 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
|
}
|
|
@@ -286,7 +296,7 @@ var UniRequest = /*#__PURE__*/function () {
|
|
|
286
296
|
name: name,
|
|
287
297
|
header: header,
|
|
288
298
|
timeout: this.uploadTimeout,
|
|
289
|
-
method: '
|
|
299
|
+
method: 'POST'
|
|
290
300
|
}, uploadFilePromise);
|
|
291
301
|
}
|
|
292
302
|
}]);
|
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
|
}
|
|
@@ -292,7 +302,7 @@
|
|
|
292
302
|
name: name,
|
|
293
303
|
header: header,
|
|
294
304
|
timeout: this.uploadTimeout,
|
|
295
|
-
method: '
|
|
305
|
+
method: 'POST'
|
|
296
306
|
}, uploadFilePromise);
|
|
297
307
|
}
|
|
298
308
|
}]);
|