我在 vuejs 应用程序中使用带有标头的 axios get 请求。在 Chrome 和 Firefox 中工作正常并得到响应。但在边缘它不起作用,出现网络错误。我正在发送带有标题授权的请求。
axios.get(url, {
headers: {
'Authorization': 'Basic bmlwerydmFdfgdfgdfllobjhJayw='
}
})
.then(function(response) {
console.log("Success");
}
}).catch(function(error) {
console.log(error);
});
在控制台中显示以下错误。
[object Error]: {config: Object, description: "Network Error", message:
"Network Error", request: Object, response: undefined...}
config: Object
description: "Network Error"
message: "Network Error"
request: Object
response: undefined
stack: "Error: Network Error at e.exports
(https://unpkg.com/[email protected] /cdn-cgi/l/email-protection/dist/axios.min.js:8:4473) at l.onerror
(https://unpkg.com/[email protected] /cdn-cgi/l/email-protection/dist/axios.min.js:8:3317)"
__proto__: Object
如果我们发送没有任何标头的 get 请求,它会正常工作。我如何使用标头授权调用 axios。
谢谢
None
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)