axios GET javascript add header in get code example
Example 1: axios.post headers example
axios.post(
'https://example.com/postSomething',
{ // this is the body
email: varEmail,
password: varPassword
},
{
headers: {
Authorization: 'Bearer ' + varToken
}
})
Example 2: making axios call with headers
axios.post('url', {"body":data}, {
headers: {
'Content-Type': 'application/json'
}
}
)