From 6ae072fdb79fb5f0bcbc5c09a12f14681c53751e Mon Sep 17 00:00:00 2001 From: Jake Hobbs Date: Fri, 21 Jun 2024 13:43:55 -0700 Subject: [PATCH] fix url param --- service/handlers.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/service/handlers.go b/service/handlers.go index 2fc3e43..d181928 100644 --- a/service/handlers.go +++ b/service/handlers.go @@ -9,7 +9,6 @@ import ( "github.com/dxe/helptheducks.com/service/config" "github.com/dxe/helptheducks.com/service/model" - "github.com/go-chi/chi/v5" ) type CreateMessageInput struct { @@ -100,7 +99,12 @@ type GetTallyResp struct { } func getTallyHandler(w http.ResponseWriter, r *http.Request) { - campaign := chi.URLParam(r, "campaign") + queryParams := r.URL.Query() + campaign := queryParams.Get("campaign") + if (campaign == "") { + http.Error(w, "missing campaign", http.StatusBadRequest) + return + } tally, err := model.GetTally(db, campaign) if err != nil {