📜  axios.get 中的标头 - 任何代码示例

📅  最后修改于: 2022-03-11 14:59:33.093000             🧑  作者: Mango

代码示例1
const axios = require('axios');

// httpbin.org gives you the headers in the response
// body `res.data`.
// See: https://httpbin.org/#/HTTP_Methods/get_get
const res = await axios.get('https://httpbin.org/get', {
  headers: {
    'Test-Header': 'test-value'
  }
});

res.data.headers['Test-Header']; // "test-value"