'Why does axios keep sending requests?

This is my code:

var axios = require("axios").default;
var btoa = require("btoa")

var options = {
  method: 'POST',
  url: 'https://qrcode3.p.rapidapi.com/qrcode/text',
  headers: {
    'content-type': 'application/json',
    'x-rapidapi-host': 'qrcode3.p.rapidapi.com',
    'x-rapidapi-key': '*****'
  },
  data: {
    data: 'https://linqr.app',
    image: {uri: 'icon://appstore', modules: true},
    style: {
      module: {color: 'black', shape: 'default'},
      inner_eye: {shape: 'default'},
      outer_eye: {shape: 'default'},
      background: {}
    },
    size: {width: 200, quiet_zone: 4, error_correction: 'M'},
    output: {filename: 'qrcode', format: 'png'}
  }
};

axios.request(options).then(function (response) {
    console.log(btoa(response.data));
}).catch(function (error) {
    console.error(error);
});

I run the file with nodemon and it keeps sending requests over and over again... why does it not send the request only once?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source