Skip to content

Commit

Permalink
Expose ratelimit headers (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
aasifkhan7 authored Oct 16, 2024
1 parent 9bc7f87 commit 60b68da
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/middleware/ratelimiter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

0 comments on commit 60b68da

Please sign in to comment.