From 028ddebc00dcbedaf682d551c88005764929e93f Mon Sep 17 00:00:00 2001 From: Till Faelligen Date: Tue, 12 Oct 2021 11:42:46 +0200 Subject: [PATCH] Don't send multiple headers --- mediaapi/routing/routing.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mediaapi/routing/routing.go b/mediaapi/routing/routing.go index 4aa23cbe8..44f9a9d69 100644 --- a/mediaapi/routing/routing.go +++ b/mediaapi/routing/routing.go @@ -125,11 +125,11 @@ func makeDownloadAPI( // Ratelimit requests if r := rateLimits.Limit(req); r != nil { - rw := json.NewEncoder(w) - w.WriteHeader(http.StatusTooManyRequests) - if err := rw.Encode(r); err != nil { + if err := json.NewEncoder(w).Encode(r); err != nil { w.WriteHeader(http.StatusInternalServerError) + return } + w.WriteHeader(http.StatusTooManyRequests) return }