Closed ruiquelhas closed 8 years ago
Actually, you can catch rate-limit errors
, and do anything you want.
Yes, but it feels a bit hacky, don't you think? I would like to override the headers for any kind of response (be it an error or not), and calling throw()
with a 200 OK
seems weird.
Should we add a hook function such as onReachLimit(ctx, limit)
?
cc @tj @jonathanong @koajs/ratelimit
onReachLimit
can't resolve @ruiquelhas 's problem, these headers will always set.
I don't think a hook would be the best solution for my problem. Providing the header names in the options
and just use them instead will probably make more sense.
I have a branch with those changes, I just wanted to know if it made sense to you before submiting the PR.
I have a branch with those changes, I just wanted to know if it made sense to you before submiting the PR.
@ruiquelhas can you submit PR first :)
@dead-horse Oh, yea! My fault.
Hi. As far as I can tell, there is currently no support for setting custom header names (for
X-RateLimit-Limit
,X-RateLimit-Remaining
andX-RateLimit-Reset
). Would you consider accepting a PR for it?Thanks.