From cc7c757fb44bb3c50345353c6193b64a4b865dd2 Mon Sep 17 00:00:00 2001 From: aasifkhan7 Date: Tue, 15 Oct 2024 00:37:20 +0530 Subject: [PATCH] Update ratelimiter.go --- internal/middleware/ratelimiter.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/middleware/ratelimiter.go b/internal/middleware/ratelimiter.go index 66ea05a..c17b4a0 100644 --- a/internal/middleware/ratelimiter.go +++ b/internal/middleware/ratelimiter.go @@ -159,4 +159,7 @@ func addRateLimitHeaders(w http.ResponseWriter, limit, remaining, used, resetTim w.Header().Set("x-ratelimit-remaining", strconv.FormatInt(remaining, 10)) w.Header().Set("x-ratelimit-used", strconv.FormatInt(used, 10)) w.Header().Set("x-ratelimit-reset", strconv.FormatInt(resetTime, 10)) + + // Expose the rate limit headers to the client + w.Header().Set("Access-Control-Expose-Headers", "x-ratelimit-limit, x-ratelimit-remaining, x-ratelimit-used, x-ratelimit-reset") }