Don't send multiple headers

This commit is contained in:
Till Faelligen 2021-10-12 11:42:46 +02:00
parent 5fccb3c1a0
commit 028ddebc00

View file

@ -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
}