chore: linter: perfsprint

Signed-off-by: Jakob Borg <jakob@kastelo.net>
This commit is contained in:
Jakob Borg
2025-10-23 22:48:54 +02:00
parent c883f49a24
commit 98cf5872e9
9 changed files with 17 additions and 16 deletions
+3 -2
View File
@@ -12,6 +12,7 @@ import (
"context"
"fmt"
"net/http"
"strconv"
"strings"
"sync"
"time"
@@ -50,13 +51,13 @@ func (resp *recordedResponse) ServeHTTP(w http.ResponseWriter, r *http.Request)
if strings.Contains(r.Header.Get("Accept-Encoding"), "gzip") {
w.Header().Set("Content-Encoding", "gzip")
w.Header().Set("Content-Length", fmt.Sprint(len(resp.gzip)))
w.Header().Set("Content-Length", strconv.Itoa(len(resp.gzip)))
w.WriteHeader(resp.status)
_, _ = w.Write(resp.gzip)
return
}
w.Header().Set("Content-Length", fmt.Sprint(len(resp.data)))
w.Header().Set("Content-Length", strconv.Itoa(len(resp.data)))
w.WriteHeader(resp.status)
_, _ = w.Write(resp.data)
}