我正在使用axios
。请问为什么我的request header
参数没有在请求中传递。这是我的代码
https://codesandbox.io/s/flamboyant-hertz-j7mmd
const abc = () => {
axios
.get(
"https://125.16.74.160:30208/?cicleCode=undefined&pageNumber=0&pageSize=20&role=ZBM",
{ Authorization: "Bearer zad" }
)
.then(() => {
console.log("---");
})
.catch(e => {
console.log(e);
});
};
为什么在请求标头中未传递
Authorization
参数。最佳答案
您必须指定headers
属性:
.get(
"https://125.16.74.160:30208/?cicleCode=undefined&pageNumber=0&pageSize=20&role=ZBM",
{ headers:{ Authorization: "Bearer zad" } }
)
关于javascript - 为什么没有在响应中的get request中传递请求 header ?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/57464691/