Answers for "how to set global axios headers"

11

making axios call with headers

axios.post('url', {"body":data}, {
    headers: {
    'Content-Type': 'application/json'
    }
  }
)
Posted by: Guest on September-24-2020
1

remove global header axios

axios.get('http://example.com', {transformRequest: (data, headers) => {
    delete headers.common['Authorization'];
  }
});
Posted by: Guest on May-01-2021
0

set variable to header axios

axios.defaults.headers.post['header1'] = 'value' // for POST requests
axios.defaults.headers.common['header1'] = 'value' // for all requests
Posted by: Guest on November-24-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language