axios get request with header Authorization not wo

2019-08-16 18:29发布

I am using axios get request with headers in vuejs application. Working fine and getting response in chrome and firefox. But in edge its not working, getting Network Error. I am sending the request with header Authorization.

 axios.get(url, {
    headers: {
    'Authorization': 'Basic bmlwerydmFdfgdfgdfllobjhJayw='
   }
  })
  .then(function(response) {
    console.log("Success");
   }
  }).catch(function(error) {
  console.log(error);
 });

showing following error in console.

 [object Error]: {config: Object, description: "Network Error", message: 
 "Network Error", request: Object, response: undefined...}

   config: Object
   description: "Network Error"
   message: "Network Error"

   request: Object
   response: undefined
   stack: "Error: Network Error at e.exports 
   (https://unpkg.com/axios@0.18.0/dist/axios.min.js:8:4473) at l.onerror 
   (https://unpkg.com/axios@0.18.0/dist/axios.min.js:8:3317)"

   __proto__: Object

if we send get request without any header it will work fine.How can i call axios with header Authorization.

Thank you

标签: vue.js axios
0条回答
登录 后发表回答