📜  带有基本身份验证的 Axios GET Req - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:13.707000             🧑  作者: Mango

代码示例1
const res = await axios.get('https://httpbin.org/basic-auth/foo/bar', {
  // Axios looks for the `auth` option, and, if it is set, formats a
  // basic auth header for you automatically.
  auth: {
    username: 'foo',
    password: 'bar'
  }
});
res.status; // 200