diff options
Diffstat (limited to 'controller/recipe.go')
-rw-r--r-- | controller/recipe.go | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/controller/recipe.go b/controller/recipe.go index aec7144..33d4063 100644 --- a/controller/recipe.go +++ b/controller/recipe.go @@ -8,8 +8,6 @@ import ( "time" "xengineering.eu/ceres/model" - - "github.com/gorilla/mux" ) func RecipeCreate(db *model.DB) func(http.ResponseWriter, *http.Request) { @@ -56,7 +54,7 @@ func RecipeUpdate(db *model.DB) func(http.ResponseWriter, *http.Request) { return } - if recipe.Id != mux.Vars(r)[`id`] { + if recipe.Id != r.PathValue("id") { http.Error(w, "IDs in URL and JSON do not match", http.StatusBadRequest) return } @@ -77,7 +75,7 @@ func RecipeUpdate(db *model.DB) func(http.ResponseWriter, *http.Request) { func RecipeDelete(db *model.DB) func(http.ResponseWriter, *http.Request) { return func(w http.ResponseWriter, r *http.Request) { recipe := model.Recipe{} - recipe.Id = mux.Vars(r)[`id`] + recipe.Id = r.PathValue("id") var obj model.Object = &recipe err := db.Transaction(obj.Delete) |