ApplyLimit applies rate limit conditionally using the global limiter
(h http.HandlerFunc, rateLimit bool)
| 140 | |
| 141 | // ApplyLimit applies rate limit conditionally using the global limiter |
| 142 | func ApplyLimit(h http.HandlerFunc, rateLimit bool) http.Handler { |
| 143 | ret := h |
| 144 | |
| 145 | if rateLimit { |
| 146 | ret = defaultLimiter.Limit(ret) |
| 147 | } |
| 148 | |
| 149 | return ret |
| 150 | } |