随笔 - 432  文章 - 0  评论 - 15  阅读 - 63万

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   狼来了  阅读(8804)  评论(0编辑  收藏  举报
编辑推荐:
· .NET Core 托管堆内存泄露/CPU异常的常见思路
· PostgreSQL 和 SQL Server 在统计信息维护中的关键差异
· C++代码改造为UTF-8编码问题的总结
· DeepSeek 解答了困扰我五年的技术问题
· 为什么说在企业级应用开发中,后端往往是效率杀手?
阅读排行:
· 10亿数据,如何做迁移?
· 推荐几款开源且免费的 .NET MAUI 组件库
· 清华大学推出第四讲使用 DeepSeek + DeepResearch 让科研像聊天一样简单!
· 易语言 —— 开山篇
· Trae初体验
< 2025年2月 >
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 1
2 3 4 5 6 7 8

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