【发布时间】:2019-09-07 07:52:03
【问题描述】:
我是 axios 的新手。我正在尝试发送带有授权标头的发布请求。响应数据在 Post man 中返回。但我在浏览器中看不到任何响应数据。请帮忙。
axios.post('http://13.127.3.151:8080/v1/dashboard/getuserdetails', {
utype: "staff",
uemail: "abdulwahidnasir@bitsathy.ac.in"
},
{ headers: { 'Authorization': `Bearer ${serviceToken}`,
'Content-Type': 'multipart/form-data' } })
.then(response => {
console.log(response);
})
.catch(error => {
console.log(error.response)
});
【问题讨论】:
-
网络标签显示什么?
-
response.data中的所有内容。DATALIST在 postman 中是 len 1 的数组,但在 axios 请求中是 len 0 的数组,但我认为这不是 axios 的问题。 -
仅供参考。您也向世界公开了 Bearer 令牌。 确保更改它。当您不知道自己在做什么时,这是有风险的。
-
网络选项卡在 DATALIST 中显示空响应
-
不记名令牌每 3 分钟过期一次
标签: reactjs axios react-hooks