aishek / axios-rate-limit

Rate limit for axios
MIT License
237 stars 35 forks source link

Support for X-RateLimit-* and X-Rate-Limit-* headers #77

Open AdalynBlack opened 1 month ago

AdalynBlack commented 1 month ago

While these headers aren't necessarily standardized, many APIs return X-RateLimit-*, and some also return X-Rate-Limit-* headers. Most commonly, there's Limit, Remaining, and Reset headers, with Scope also being somewhat common (denoting that multiple rate limits are in use depending on the endpoint, as well as which rate limit is current being reported on). It would make sense to implement these headers to automatically set the rate limiter's internal values, that way the rate limiter and the API endpoint are synchronized in their expectations of when things should happen