headers in axios.get
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"
Source: masteringjs.io
axios.headers.common
// Set authorization headers on axios axios.defaults.headers.common['Authorization'] = AUTH_TOKEN;
axios defaults headers common
// GET request for remote image axios({ method: 'get', url: 'http://bit.ly/2mTM3nY', responseType: 'stream' }) .then(function(response) { response.data.pipe(fs.createWriteStream('ada_lovelace.jpg')) });
Source: kapeli.com