6

axios.post() 方法 设置请求头

 1 year ago
source link: http://surest.cn/archives/217/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

axios.post() 方法 设置请求头

Published on Dec 6, 2022 in 前端 with 0 comment

axios.post('/your-url', data, {
  headers: {
    'Content-Type': 'application/json',
    // other headers here...
  }
});

在这个例子中,我们设置了 Content-Type 头,指定了请求的数据格式为 JSON。您可以添加其他的头信息,只需要在 headers 对象中添加新的键值对即可。

本文由 邓尘锋 创作,采用 知识共享署名4.0 国际许可协议进行许可
本站文章除注明转载/出处外,均为本站原创或翻译,转载前请务必署名
最后编辑时间为: Dec 6, 2022 at 02:11 pm


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK