微信小程序 request header 带 cookie 参数
//对wx.request实现二次封装 function(args) { var that = this; var header = { 'content-type': 'application/json; charset=utf-8', 'cookie': wx.getStorageSync("sessionid") }; reqObj=wx.request({ url: that.baseUrl + args.url, method: "POST", header: header, data: JSON.stringify(args.data), success(res) { var cookie = res.header["Set-Cookie"]; if (cookie != null) { wx.setStorageSync("sessionid", res.header["Set-Cookie"]); } if (args.success) args.success(res); }, complete(res) { if (args.complete) args.complete(res); } }) }