axios get,post请求时带headers

axios post请求时带headers:

1
2
3
4
axios.post("http://xxx.com/xxx/xxx/xxx?", { 'queslistid': this.kemuid }, { headers: { 'token': Cookies.get('token'), 'platform': 'web' } }
).then((login) => {
  console.log(login)
});

  

axios get请求时带headers:

1
2
3
4
axios.get("http://xxx.com/xxx/?", { params: { id: this.kemuid }, headers: { token: Cookies.get('token'), platform: 'web' } }
).then((res) => {
  console.log(res);
});

  

posted on   狼来了  阅读(8803)  评论(0编辑  收藏  举报
努力加载评论中...

点击右上角即可分享
微信分享提示