Answers for "axios set common header"

1

axios get with headers

let auth = ``; //auth key
let url = ``; //api url

const axios = require(`axios`);
axios({
    method: 'get',
    url: url,
    headers: {
        "Authorization": auth
    },
}).then(function (res) {
    console.log(res.data)
});
Posted by: Guest on August-27-2021
0

axios.headers.common

// Set authorization headers on axios
axios.defaults.headers.common['Authorization'] = AUTH_TOKEN;
Posted by: Guest on September-05-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language