axios

Estimated reading time: 1 minute

axios

header issue get and post

  • https://github.com/axios/axios/issues/638#issuecomment-271119591 get
  • https://stackoverflow.com/a/44617848 post/get
  • https://github.com/axios/axios/issues/858#issuecomment-302257238 post
  • https://github.com/axios/axios/issues/827#issuecomment-338290911 post

get

axios.get('https://t.co',{
  params:{
    name: 'kamal'
  },
  headers: {
    Authorization: 'mkk'
  }
})
.then((response) => {
  // response
})
.catch((error) => {
  // error
})

delete

axios.delete(url, {
  data:{
    username:"user",
    password:"pass"
  },
  headers:{
    Authorization: "token"
  }
})


axios chaining

axios.get(...)
  .then((response) => {
    return axios.get(...); // using response.data
  })
  .then((response) => {
    console.log('Response', response);
  });

query string package