From 3355a7d1dd8899945b6186ffd7ece2784df1c4a4 Mon Sep 17 00:00:00 2001 From: igorgoldobin Date: Wed, 7 Feb 2024 11:04:36 +1000 Subject: [PATCH] added log --- internal/server/middleware.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/server/middleware.go b/internal/server/middleware.go index 5c7df8f..7eb76f9 100644 --- a/internal/server/middleware.go +++ b/internal/server/middleware.go @@ -78,7 +78,8 @@ func (l *Limiter) ServeHTTP(w http.ResponseWriter, r *http.Request, next http.Ha func (l *Limiter) limitByKey(w http.ResponseWriter, key string) bool { if _, ttl, err := l.cache.GetWithTTL(key); err == nil { - errMsg := fmt.Sprintf("You have exceeded the rate limit. Please wait %s before you try again", ttl.Round(time.Second)) + errMsg := fmt.Sprintf("You have exceeded the rate limit for %s. Please wait %s before you try again", key, ttl.Round(time.Second)) + fmt.Println(errMsg) renderJSON(w, claimResponse{Message: errMsg}, http.StatusTooManyRequests) return true }