diff --git a/internal/server/concurrency.go b/internal/server/concurrency.go index ea00c3ae..ddb05c13 100644 --- a/internal/server/concurrency.go +++ b/internal/server/concurrency.go @@ -45,7 +45,9 @@ func CreateConcurrencyMiddleware(cfg config.Config) chain.Middleware { return } if !sem.TryAcquire(1) { - http.Error(w, "Too many requests", http.StatusTooManyRequests) + w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusTooManyRequests) + w.Write([]byte(`{"error":"Too many requests"}`)) return } defer sem.Release(1)