node-saucelabs icon indicating copy to clipboard operation
node-saucelabs copied to clipboard

SauceLabs module should provide RateLimit headers to downstream libraries

Open kennydrobnack opened this issue 9 years ago • 5 comments
trafficstars

As part of a project, I'm using SauceLabs to test some code. SauceLabs recently announced they are rate limiting the number of API calls to their services.

http://sauceio.com/index.php/2016/02/announcing-new-rest-api-usage-limits/

One thing we wanted to do was to monitor the usage of the API calls and throw a warning if we are coming close to hitting the limits. However the SauceLabs library only provides the parsed JSON, not any of the headers (including the Rate Limit data).

The function that seems to be impacted by this is makeRequest in SauceLabs.js. Is there any easy way to provide the X-Ratelimit header data along with the JSON parsed response?

kennydrobnack avatar Feb 25 '16 20:02 kennydrobnack

We could add a third argument in the returned callback with the HTTP response which would include the code and headers etc? Then people could use any of that data? That would be easy to implement...

@unindented @OniOni what are your thoughts?

danjenkins avatar Feb 27 '16 16:02 danjenkins

@danjenkins Yup, that solution sounds reasonable.

unindented avatar Feb 28 '16 17:02 unindented

OK, feel free to send in a PR @kennydrobnack or I'll tackle this once I'm back from my honeymoon! :)

danjenkins avatar Mar 03 '16 21:03 danjenkins

@danjenkins Congratulations!

PhearZero avatar Mar 04 '16 20:03 PhearZero

Congrats @danjenkins! I've actually been pulled into another project at work and found that we're a ways off from hitting our rate limit. That may change in the next few months, but it's not urgent right now.

I'll keep myself subscribed to this and let the guys doing the SauceLabs tests know once this fix is available.

kennydrobnack avatar Mar 04 '16 23:03 kennydrobnack