From ec52d8a8cf7b2ea4a19c6630e114a800127b0074 Mon Sep 17 00:00:00 2001 From: Alex Kolarski <aleks.rk@gmail.com> Date: Sat, 9 Apr 2016 11:00:25 +0300 Subject: [PATCH] Add response object to getTimeline Response object contains the important Twitter headers: *X-Rate-Limit-Limit*: the rate limit ceiling for that given request *X-Rate-Limit-Remaining*: the number of requests left for the 15 minute window *X-Rate-Limit-Reset*: the remaining window before the rate limit resets in UTC epoch seconds Which can be used to rate limit the usage of the library. Without the response object there is not other way to obtain the twitter rate numbers. --- twitter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/twitter.js b/twitter.js index de3176b..3261f98 100644 --- a/twitter.js +++ b/twitter.js @@ -107,7 +107,7 @@ Twitter.prototype.getTimeline = function(type, params, accessToken, accessTokenS callback(error); } else { try { - callback(null, JSON.parse(data)); + callback(null, JSON.parse(data), response); } catch (e) { callback(e, data, response); }