wx.request的header中有数值,服务端收到Object Number
var session_id = wx.getStorageSync(‘session_id’) || 0;
var role = parseInt(wx.getStorageSync(‘role’)) || 0;
wx.request({
url: options.url,
data: options.data,
method: options.method || ‘POST’,
header: { ‘content-type’: ‘application/x-www-form-urlencoded’, ‘X-SessionId’: session_id, ‘X-Role’: role },
success: function(res){}
}
header中的role是数值0/1/2/3,服务端偶尔会收到’[object number]’
服务端错误:ValueError: invalid literal for int() with base 10: ‘[object Number]’