Trying to do a request through request-promise but it's not working properly.
See the comment below.
Can somebody explain this PiA to me?
Thanks in advance
var todayOptions = { uri: `http://mlb.mlb.com/gdcross/components/game/mlb/year_${year}/month_${month}/day_${day}/master_scoreboard.json`, simple: false, resolveWithFullResponse: true
};
rp(todayOptions)
.then(function (response){
console.log(response.body); //RETURNS BODY
console.log(response.body.data); //RETURNS UNDEFINED EVEN THOUGH IT EXISTS
})
.catch(function(error){
console.log(error);
});
via Kyriediculous
No comments:
Post a Comment