mirror of
https://codeberg.org/scip/anydb.git
synced 2026-10-08 11:14:20 +02:00
satisfy linter
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user