From 7d64e9194992e18263079ab2093d60a04bf952a1 Mon Sep 17 00:00:00 2001 From: pablomendezroyo Date: Mon, 20 May 2024 10:47:34 +0200 Subject: [PATCH] fix get network from query parameter --- listener/internal/api/handlers/postSignatures.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/listener/internal/api/handlers/postSignatures.go b/listener/internal/api/handlers/postSignatures.go index aaaa8f6..9ddd67c 100644 --- a/listener/internal/api/handlers/postSignatures.go +++ b/listener/internal/api/handlers/postSignatures.go @@ -8,7 +8,6 @@ import ( "github.com/dappnode/validator-monitoring/listener/internal/api/types" "github.com/dappnode/validator-monitoring/listener/internal/api/validation" "github.com/dappnode/validator-monitoring/listener/internal/logger" - "github.com/gorilla/mux" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo/options" @@ -18,11 +17,10 @@ func PostSignatures(w http.ResponseWriter, r *http.Request, dbCollection *mongo. logger.Debug("Received new POST '/signatures' request") var requests []types.SignatureRequest - // Get network from URL - vars := mux.Vars(r) - networkVar, ok := vars["network"] - if !ok { - respondError(w, http.StatusBadRequest, "Invalid URL, missing network") + // Get network from query parameter + networkVar := r.URL.Query().Get("network") + if networkVar == "" { + respondError(w, http.StatusBadRequest, "Missing network query parameter") return } network := types.Network(networkVar)