Chroisen
Chroisen
  • 发布:2022-01-24 00:25
  • 更新:2022-12-07 14:24
  • 阅读:868

【报Bug】app端uni.request GET请求 responseType: "arraybuffer"返回的data为空

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Mac

PC开发环境操作系统版本号: 12.2

HBuilderX类型: 正式

HBuilderX版本号: 3.3.8

手机系统: iOS

手机系统版本号: iOS 14

手机厂商: 模拟器

手机机型: iPhone 12 Pro Max

页面类型: vue

vue版本: vue3

打包方式: 云端

项目创建方式: HBuilderX

示例代码:
static request(url, { data, header, responseType, method = "GET", }) {  
    return new Promise((resolve, reject) => {  
      uni.request({  
        url: url,  
        method,  
        data: data,  
        header: header,  
        responseType: responseType,  
        success: resolve,  
        fail: reject,  
      });  
    });  
  }  
 let response = await Utils.request(  
        "https://xxxxxxx/1.xlsx",  
        {  
          responseType: "arraybuffer",  
        }  
      );  
      console.log("response", response);

操作步骤:
console.log("response", response);

预期结果:
{  
    "data": {  
                ArrayBuffer(3053280)  
         },  
    "statusCode": 200,  
    "header": {  
        "Server": "nginx",  
        "Content-Type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",  
        "Last-Modified": "Sun, 23 Jan 2022 16:14:53 GMT",  
        "Strict-Transport-Security": "max-age=31536000",  
        "Date": "Sun, 23 Jan 2022 16:15:32 GMT",  
        "Accept-Ranges": "bytes",  
        "Content-Length": "3053280",  
        "Etag": "\"61ed7efd-2e96e0\""  
    },  
    "errMsg": "request:ok",  
    "cookies": []  
}

实际结果:
{  
    "data": {},  
    "statusCode": 200,  
    "header": {  
        "Server": "nginx",  
        "Content-Type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",  
        "Last-Modified": "Sun, 23 Jan 2022 16:14:53 GMT",  
        "Strict-Transport-Security": "max-age=31536000",  
        "Date": "Sun, 23 Jan 2022 16:15:32 GMT",  
        "Accept-Ranges": "bytes",  
        "Content-Length": "3053280",  
        "Etag": "\"61ed7efd-2e96e0\""  
    },  
    "errMsg": "request:ok",  
    "cookies": []  
}

bug描述:

app端,uni.request GET请求 responseType: "arraybuffer"返回的data为空。H5正常。

2022-01-24 00:25 负责人:无 分享
已邀请:
1***@qq.com

1***@qq.com

您好,,也遇到了这个问题,有解决方法吗

该问题目前已经被锁定, 无法添加新回复