API Server返回httpStatusCode为500, body携带错误信息, wx.request却相应了success函数。导致外面包装的Promise执行了resolve
//代码, 红色部分为log输出
return new Promise(function (resolve, reject) {
wx.request({
url: config.apiRoot + uri,
method: ‘POST’,
data: data,
header: _.extend({
‘content-type’: ‘application/json’
}, config.headers),
success: function (res) {
console.log(‘正确在这里’)
console.log(res);
resolve(res.data)
},
fail: function (res) {
console.log(‘错误在这里’)
reject(res)
},
complete: function () {
if (opt.showToast) {
_hideLoading()
}
}
})
});
//Console截图