为什么没有在响应中的get request中传递请求标头?

use*_*513 1 javascript reactjs react-redux axios

我正在使用。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);
      });
  };
Run Code Online (Sandbox Code Playgroud)

为什么Authorization未在请求标头中传递参数。

在此处输入图片说明

Dup*_*cas 5

您必须指定headers属性:

  .get(
    "https://125.16.74.160:30208/?cicleCode=undefined&pageNumber=0&pageSize=20&role=ZBM",
    { headers:{ Authorization: "Bearer zad" } }
  )
Run Code Online (Sandbox Code Playgroud)