Answers for "axios get with header not working"

1

axios get request with headers in token

axios.get('https://api.github.com/user', {
  headers: {
    'Authorization': `token ${access_token}`
  }
})
.then((res) => {
  console.log(res.data)
})
.catch((error) => {
  console.error(error)
})
Posted by: Guest on April-19-2021
11

making axios call with headers

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

Code answers related to "Javascript"

Browse Popular Code Answers by Language