Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Axios: Network Error and not sending request

I am trying to send a get request with auth headers to api from Vue using axios.

When I try to send it, it gives me a Network Error with no info about it. I have also check network tab and the request is not sending at all.

Before I checked the url using postman and https://www.hurl.it/ and it worked as expected.

Also, I have sent a request to this api using axios to get a token.

Thank you.

const token = "token";

let options = {
    method: 'GET',
    url: 'http://smev.test-it-studio.ru/api/analytics/PortfolioStructure',
    headers: {
        'Authorization': `Bearer ${token}`
    },
};

axios(options).then((data) => {
    console.log(data);
}).catch((error) => {
    console.log(error.config);
});

EDIT: Here is the error I get:

Error
  columnNumber: 15
  config: {…}
    adapter: function xhrAdapter()
    baseURL: "http://smev.test-it-studio.ru"
    data: undefined
    headers: Object { Accept: "application/json", Authorization: "Bearer token"}
    maxContentLength: -1
    method: "GET"
    timeout: 0
    transformRequest: Object [ transformRequest() ]
    transformResponse: Object [ transformResponse() ]
    url: "http://smev.test-it-studio.ru/api/analytics/PortfolioStructure"
    validateStatus: function validateStatus()
    xsrfCookieName: "XSRF-TOKEN"
    xsrfHeaderName: "X-XSRF-TOKEN"
    __proto__: Object { … }
  fileName: "http://uralsib-lk.dev/dist/build.js"
  lineNumber: 19074
  message: "Network Error"
  response: undefined
  stack: "createError@http://uralsib-lk.dev/dist/build.js:19074:15\nhandleError@http://uralsib-lk.dev/dist/build.js:18962:14\n"
  __proto__: Object { … }
  build.js:18589:24
like image 980
dan070 Avatar asked Dec 10 '22 08:12

dan070


1 Answers

With the help from Soleno, I found out that it was AdBlock what was blocking the request.

like image 89
dan070 Avatar answered Dec 12 '22 21:12

dan070