wx.request 怎么传递protobufjs生成的uint8Array的数据?
发布于 5 年前 作者 dongjing 4497 次浏览 来自 官方Issues
buffer1 是protobufjs encode后的数据,但是传递到后端。后端解析的时候 总是说格式不正确?请问有没有做过类似的需求的,谢谢~~

wx.request({
  url: 'xxxxx', //仅为示例,并非真实的接口地址
  data: buffer1,
  method: "POST",
  header: {
    'content-type': 'application/x-protobuf' // 默认值
  },
  responseType:'arraybuffer',
  success: function (res) {
    console.log(res);
  },
  fail: function (err){
    console.log(err);
  }
})

回到顶部