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 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
- res(data.data);
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
- res(data.data);
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uniapp-request-sdk",
3
- "version": "1.4.10",
3
+ "version": "1.4.11",
4
4
  "description": "用于uniapp小程序的请求库的sdk",
5
5
  "main": "dist/index.umd.js",
6
6
  "module": " dist/index.esm.js",