mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-04-28 03:20:11 +00:00
Fix X-RateLimit-Limit header value (#575)
Fix X-RateLimit-Limit header value
This commit is contained in:
commit
20d94f4c90
1 changed files with 2 additions and 1 deletions
|
|
@ -2,6 +2,7 @@ package api
|
|||
|
||||
import (
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
|
@ -156,7 +157,7 @@ func UniversalRateLimitMiddleware(next http.Handler) http.Handler {
|
|||
if !limiter.Allow(ip) {
|
||||
// Add retry-after header
|
||||
w.Header().Set("Retry-After", "60")
|
||||
w.Header().Set("X-RateLimit-Limit", string(rune(limiter.limit)))
|
||||
w.Header().Set("X-RateLimit-Limit", strconv.Itoa(limiter.limit))
|
||||
w.Header().Set("X-RateLimit-Remaining", "0")
|
||||
w.Header().Set("X-RateLimit-Reset", time.Now().Add(limiter.window).Format(time.RFC3339))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue