From 2b4999c73d175302e92a23f8081fb6eff13e8b50 Mon Sep 17 00:00:00 2001 From: spsobole Date: Mon, 29 May 2023 14:38:37 -0600 Subject: [PATCH] Fix Vars fetching --- context.go | 17 +++++------------ server.go | 1 + 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/context.go b/context.go index a42ee63..05ea085 100644 --- a/context.go +++ b/context.go @@ -8,6 +8,7 @@ import ( "net/http" "git.twelvetwelve.org/library/snap/auth" + "github.com/gorilla/mux" ) type Context struct { @@ -191,21 +192,13 @@ func (c *Context) ReadObject(object interface{}) error { } func (c *Context) ParseVars() *Options { - if c.form != nil { - return &Options{ - kv: c.form, + if c.vars == nil { + c.vars = &Vars{ + vars: mux.Vars(c.r), } } - err := c.r.ParseForm() - if err != nil { - return nil - } - c.form = &Form{ - r: c.r, - } - return &Options{ - kv: c.form, + kv: c.vars, } } diff --git a/server.go b/server.go index cba2a5f..fb39673 100644 --- a/server.go +++ b/server.go @@ -57,6 +57,7 @@ func (s *Server) makeContext(auth *auth.AuthData, w http.ResponseWriter, r *http w: w, srv: s, auth: auth, + vars: mux.Vars(r), } return c }