http - 如何在没有任何 vuex 库(axios)的情况下在 vue 回调中获取 http 响应 header

标签 http vue.js axios

我想在 vuejs 的 get 请求的回调中获取 http 响应 header 。但是我不能为此使用任何库或第三方。

有一些第三方比如axios,但是在我的代码中不允许使用。

最佳答案

fetch("YOUR API REQUEST").then((res) => console.log(res.headers);
)
.then((data) =>  console.log(data))
.catch((err)=>console.error(err))

关于http - 如何在没有任何 vuex 库(axios)的情况下在 vue 回调中获取 http 响应 header ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56437530/

相关文章:

java - JMeter HTTP 请求中的传输编码 header 已存在错误

http - HTTP get 请求的格式

未解析 URL 的 HTTP 状态代码

Javascript:切换按钮无法正常工作

javascript - 错误 : Request failed with status code 400. 在 POSTMAN 和应用程序中发送之间的差异

jquery - HTTP 缓存 : Why use ETag instead of Cache-Control and/or Expires?

vue.js - 如何在 Buefy 中配置 Font Awesome

javascript - 在 vuejs 2 中独立时更新组件属性

javascript - 将jsPDF生成的PDF发送到服务器

reactjs - 无法使用 axios 发送 auth header