wx.login中通过http向后台传code值,网络请求失败
wx.login({
success: function (res) {
if (res.code) {
// console.log('发起网络请求:' + res.code)
wx.request({
url: 'https://test.com/onLogin',
data: {
code: res.code
}
})
}
}
})
url用的是http协议,报错:net::ERR_CONNECTION_REFUSED。在控制台看到http协议变为了https。