I'm trying to make a request to the Google Analytics API. I'm using Passport.js to authorize the user and this library to make requests.
I get a nice repsonse from Google but my problem is that the request keeps on going until it times out even after I've received the repsonse. The request keeps un running until I get a time out.
What am I doing wrong?
Here is my code:
request('https://www.googleapis.com/analytics/v3/management/accounts?access_token=' + access_token, function (error, response, body) {
if(error){
console.log(error);
}else{
console.log(repsonse);
}
});
You're probably not just returning something from the HTTP GET call you're doing. That's why it times out.
You need to send back a HTTP 200 if error does not eval to true, e.g.:
res.send();