Skip to content

Commit

Permalink
fix get network from query parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
pablomendezroyo committed May 20, 2024
1 parent 31211ed commit 7d64e91
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions listener/internal/api/handlers/postSignatures.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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)
Expand Down

0 comments on commit 7d64e91

Please sign in to comment.