diff --git a/lib/runkeeper.js b/lib/runkeeper.js index 2ceda91..b56dbd6 100644 --- a/lib/runkeeper.js +++ b/lib/runkeeper.js @@ -139,6 +139,8 @@ HealthGraph.prototype.apiCall = function(opts, callback) { * If passed opts.get_next it will get all items of the activity feed until there is no more * `data.next`. * + * If passed opts.modified_since you might get an empty response (304 Not Modified). In those cases callback(null, []) will be called + * * @param {Object} opts (Optional) Gets extended by `resources.fitnessActivityFeed`. * @param {Function} callback Given err and data. */ @@ -157,6 +159,7 @@ HealthGraph.prototype.activityFeed = function(opts, callback) { this.apiCall(opts, function(err, data) { if (err) return callback(err, null); + if (!data.items) return callback(null, []); if (data.next) { opts.items = data.items.concat(opts.items);