微信小程序获取onenet图片,api都没问题,但是却报错405,是怎么回事?
getOnenetData:function() { var that = this let deviceid = "deviceid " let apikey = "apikey " wx.request({ url: "https://api.heclouds.com/devices/" + deviceid + "/datastreams", method: 'GET', data: { picindex:'' }, header: { "content-type": 'application/x-www-form-urlencoded', // "content-type": 'application/octet-stream', "api-key": apikey }, success(res) { if (res.statusCode === 200) { /* console.log(res)*/ console.log(res) that.setData({ picindex: res.data.data[0].current_value.index, }) app.globalData.picindex = res.data.data[0].current_value.index console.log(that.data.picindex) console.log(app.globalData.picindex) } }, }) }, getOnenetpic: function () { var that = this; let apikey = 'maskapikey='//maskapi wx.request({ url: "https://api.heclouds.com/bindata/" + app.globalData.picindex, method:"GET", responseType: 'arraybuffer', data: { img: '', }, header:{ 'api-key': apikey }, success(res) { if (res.statusCode === 200) { console.log(res) // console.log(that.data.picindex) const base64=wx.arrayBufferToBase64(res.data) console.log(base64) that.setData({ img:"data:image/jpg;base64,"+base64 }) console.log(that.data.img) } } }) },