title: Post request via Axios fails while it succeeds from POSTMAN . How?
body: <p>I am trying to perform a post request with axios to an endpoint on a ubuntu vps(a django backend) . The api responds 201 created after a successful post request. Using Postman, i am able to perform a successful post request but when i am trying it with Axios, I can see the exceptions being catched in the console (i have used console.log).</p>
  
  <p><strong>Here's how i am doing it via Axios :</strong></p>
  
  <pre><code>.
  .
  .
  
  
  axios.defaults.xsrfCookieName = 'csrftoken'
  axios.defaults.xsrfHeaderName = 'X-CSRFToken'
  
  // Tried without headers as well
  var headers = {'Content-Type': 'application/x-www-form-urlencoded'}
  
  axios.post('http://127.0.0.1:8000/api/v1/subscribe/',data_str,headers)
  .then(function(response) {
  console.log('saved successfully');
  // this.isHidden = false;
  alert("Subscription succesful !!");
  console.log(response)
  }).catch((error) =&gt;{
  if(error.response){
  console.log('1..........Response Error');
  console.log(error.response.data);
  console.log(error.response.status);
  console.log(error.response.headers);
  }
  else if(error.request){
  // This part gets printed in the browser console. No idea why
  console.log('2..........Request Error');
  console.log(error.request);
  }
  else{
  console.log('3..........Other error');
  console.log('Error', error.message);
  }
  console.log(error.config);
  } );
  var headers = {'Content-Type': 'application/x-www-form-urlencoded'}
  axios.post('http://127.0.0.1:8000/api/v1/subscribe/',data_str,headers)
  .then(function(response) {
  console.log('saved successfully');
  // this.isHidden = false;
  alert("Subscription succesful !!");
  console.log(response)
  }).catch((error) =&gt;{
  if(error.response){
  console.log('1..........Response Error');
  console.log(error.response.data);
  console.log(error.response.status);
  console.log(error.response.headers);
  }
  else if(error.request){
  console.log('2..........Request Error');
  console.log(error.request);
  }
  else{
  console.log('3..........Other error');
  console.log('Error', error.message);
  }
  console.log(error.config);
  } );
  </code></pre>
  
  <p>**Few CORS configurations in my django rest api :</p>
  
  <pre><code>CORS_ORIGIN_ALLOW_ALL = True
  
  CORS_ALLOW_CREDENTIALS = True
  
  CORS_ALLOW_METHODS = ['DELETE','GET','OPTIONS','PATCH','POST','PUT',]
  
  CORS_ALLOW_HEADERS = ['*']
  </code></pre>
  
  <p>Here's the pic of the errors in console <a href="https://i.stack.imgur.com/yJfph.png" rel="nofollow noreferrer">This is the console log in browser</a></p>
  
  <p>I appreciate if anyone helps .</p>
  
  <p>Thanks in Advance !</p>