diff --git a/handlers/util.go b/handlers/util.go index d7e6dd5..82af6fa 100644 --- a/handlers/util.go +++ b/handlers/util.go @@ -1,7 +1,6 @@ package handlers import ( - "errors" "fmt" "io" "net/http" @@ -20,14 +19,14 @@ func updateEndpointValidator( if !ok || !util.CheckCredentials(authDB, validCredentials, username, password) { w.Header().Set("WWW-Authenticate", "Basic realm=\"spaceapid\"") http.Error(w, "", http.StatusUnauthorized) - return []byte{}, errors.New(fmt.Sprintf("Unauthorized request from %s Username: %s Password: %s", r.RemoteAddr, username, password)) + return []byte{}, fmt.Errorf("Unauthorized request from %s Username: %s Password: %s", r.RemoteAddr, username, password) } // Read request body body, err := io.ReadAll(r.Body) if err != nil { http.Error(w, "", http.StatusInternalServerError) - return []byte{}, errors.New(fmt.Sprintf("Failed to read request body from %s with error: %s", r.RemoteAddr, err)) + return []byte{}, fmt.Errorf("Failed to read request body from %s with error: %s", r.RemoteAddr, err) } return body, nil