Why do I get error:
"The "url" argument must be of type string. Received type undefined"
when I run this code:
P.S. I also tried to pass in variable with this URL, but the result was the same.
var axios = require('axios')();
module.exports = {
async getJSONAsync(){
let json = await axios.get('https://tutorialzine.com/misc/files/example.json');
return json;
}
};
NOTE: I use this function in another async function with await keyword. Like :
async begin() {
try {
let setup = new SetUp(this.bot);
await testapi.getJSONAsync().then(function (json) {
console.log(json)
});
let settings = await setup.prepareTest();
let session = await settings.driver.getSession();
logger.logDebug('Launching ' + this.test.name);
return settings;
}
catch (e) {
logger.logErr('Error when create settings for ' + this.test.name);
throw e;
}
}