Fix Vars fetching
This commit is contained in:
parent
15a8fed766
commit
2b4999c73d
17
context.go
17
context.go
|
@ -8,6 +8,7 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"git.twelvetwelve.org/library/snap/auth"
|
"git.twelvetwelve.org/library/snap/auth"
|
||||||
|
"github.com/gorilla/mux"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Context struct {
|
type Context struct {
|
||||||
|
@ -191,21 +192,13 @@ func (c *Context) ReadObject(object interface{}) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Context) ParseVars() *Options {
|
func (c *Context) ParseVars() *Options {
|
||||||
if c.form != nil {
|
if c.vars == nil {
|
||||||
return &Options{
|
c.vars = &Vars{
|
||||||
kv: c.form,
|
vars: mux.Vars(c.r),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err := c.r.ParseForm()
|
|
||||||
if err != nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
c.form = &Form{
|
|
||||||
r: c.r,
|
|
||||||
}
|
|
||||||
|
|
||||||
return &Options{
|
return &Options{
|
||||||
kv: c.form,
|
kv: c.vars,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue