satisfy linter

This commit is contained in:
2026-08-31 22:02:07 +02:00
parent cafc65aea7
commit 49eb1033ef
23 changed files with 327 additions and 220 deletions

View File

@@ -1,3 +1,5 @@
package rest
/*
This logging middleware is based on
@@ -7,7 +9,6 @@ https://github.com/elithrar/admission-control/blob/v0.6.3/request_logger.go
I am using slog and added a couple of small modifications.
*/
package rest
import (
"log/slog"
@@ -20,6 +21,7 @@ import (
// written HTTP status code to be captured for logging.
type responseWriter struct {
http.ResponseWriter
status int
size int
wroteHeader bool
@@ -48,7 +50,6 @@ func (rw *responseWriter) WriteHeader(code int) {
}
func (rw *responseWriter) Write(data []byte) (int, error) {
written, err := rw.ResponseWriter.Write(data)
rw.size += written
@@ -75,7 +76,9 @@ func LogHandler() func(http.Handler) http.Handler {
next.ServeHTTP(wrapped, req)
header := wrapped.Header()["Content-Type"]
contenttype := ""
var contenttype string
if header == nil {
contenttype = "text/plain"
} else {