minor cleanup in genesis server
@@ -5,8 +5,6 @@ import (
"net/http"
"time"
- "fmt"
-
errors "github.com/go-openapi/errors"
runtime "github.com/go-openapi/runtime"
middleware "github.com/go-openapi/runtime/middleware"
@@ -78,7 +76,6 @@ func configureAPI(api *operations.WeaviateGenesisAPI) http.Handler {
if err != nil {
return operations.NewGenesisPeersRegisterForbidden()
}
- peers, err := (state).ListPeers()
return operations.NewGenesisPeersRegisterOK()
} else {
return operations.NewGenesisPeersRegisterBadRequest()
@@ -134,5 +131,12 @@ func setupMiddlewares(handler http.Handler) http.Handler {
// The middleware configuration happens before anything, this middleware also applies to serving the swagger.json document.
// So this is a good place to plug in a panic handling middleware, logging and metrics
func setupGlobalMiddleware(handler http.Handler) http.Handler {
- return handler
+ return addLogging(handler)
+}
+
+func addLogging(next http.Handler) http.Handler {
+ return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ log.Debugf("Received request: %+v %+v", r.Method, r.URL)
+ next.ServeHTTP(w, r)
+ })
}
