If there are more than one limiter for same request, then headers X-RateLimit-Limit/X-RateLimit-Remaining can be incorrect. Example:
wrap-ratelimit creates header with Limit=100, Remainig=99 and calls next handler.
Next wrap-ratelimit in the chain creates header Limit=100, Remainig=0 (call is blocked).
wrap-ratelimit from step 1. overwrites X-RateLimit-Limit/X-RateLimit-Remaining.
Expected result:
X-RateLimit-Limit=100 / X-RateLimit-Remaining=0
Actual result:
X-RateLimit-Limit=100 / X-RateLimit-Remaining=99
Possible solution is to return min values:
Hi, this package is not really maintained (I haven't used Clojure in years). If you submit a fully ready pull request, I'll merge, but I'm not going to spend time on testing and stuff. :)
If there are more than one limiter for same request, then headers X-RateLimit-Limit/X-RateLimit-Remaining can be incorrect. Example:
wrap-ratelimit
creates header with Limit=100, Remainig=99 and calls next handler.wrap-ratelimit
in the chain creates header Limit=100, Remainig=0 (call is blocked).wrap-ratelimit
from step 1. overwrites X-RateLimit-Limit/X-RateLimit-Remaining. Expected result:X-RateLimit-Limit=100 / X-RateLimit-Remaining=0
Actual result:X-RateLimit-Limit=100 / X-RateLimit-Remaining=99
Possible solution is to return min values: