Closed goliatone closed 7 years ago
The API response returns rate limits information, which currently is discarded.
At least, it could be added to the result body, or whatever other way to make it available to the developer. Ideally, the library would handle this for the developer.
src/requestHandler.js:
src/requestHandler.js
let doRequest = (endpoint, method, data) => { ... request(options, function(err, res, body) { body = JSON.parse(body); if (err) { reject(err); } else if (res.statusCode < 400) { //Pass rate limit info along... body.ratelimit = { limit: parseInt(res.headers['x-ratelimit-limit'] || 0), remaining: parseInt(res.headers['x-ratelimit-remaining'] || 0), reset: parseInt(res.headers['x-ratelimit-reset'] || 0) }; resolve(body); } else { ... } }); }); };
@goliatone Can you review #6 ?
Thanks.
New version published. https://www.npmjs.com/package/ya-lifx
The API response returns rate limits information, which currently is discarded.
At least, it could be added to the result body, or whatever other way to make it available to the developer. Ideally, the library would handle this for the developer.
src/requestHandler.js
: