【发布时间】:2019-11-26 20:33:42
【问题描述】:
我正在使用 Axios 发出一个发布请求,此调用在响应标头和正文中返回数据。在标题中,它返回一个x-auth-token,我想获取此令牌的值,但它返回:
undefined is not an object
这是我的做法:
axios.post('app.com/api/login', data)
.then(response => {
console.log(response.headers.get("x-auth-token"));
})
.catch(error => {
console.log(error)
});
【问题讨论】:
标签: promise axios response response-headers