mirror of
https://github.com/gin-gonic/gin.git
synced 2026-06-04 09:48:17 +08:00
Merge b7132ed5ecb18a82bdba776eacb01dae57b88d2c into d3ffc9985281dcf4d3bef604cce4e662b1a327a6
This commit is contained in:
commit
34de06f56c
@ -907,11 +907,17 @@ func (c *Context) ShouldBindHeader(obj any) error {
|
|||||||
// ShouldBindUri binds the passed struct pointer using the specified binding engine.
|
// ShouldBindUri binds the passed struct pointer using the specified binding engine.
|
||||||
// It works like ShouldBindJSON but binds parameters from the URI.
|
// It works like ShouldBindJSON but binds parameters from the URI.
|
||||||
func (c *Context) ShouldBindUri(obj any) error {
|
func (c *Context) ShouldBindUri(obj any) error {
|
||||||
|
return c.ShouldBindUriWith(obj, binding.Uri)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ShouldBindUriWith binds the passed struct pointer using the specified uri
|
||||||
|
// binding engine. See the binding package.
|
||||||
|
func (c *Context) ShouldBindUriWith(obj any, b binding.BindingUri) error {
|
||||||
m := make(map[string][]string, len(c.Params))
|
m := make(map[string][]string, len(c.Params))
|
||||||
for _, v := range c.Params {
|
for _, v := range c.Params {
|
||||||
m[v.Key] = []string{v.Value}
|
m[v.Key] = []string{v.Value}
|
||||||
}
|
}
|
||||||
return binding.Uri.BindUri(m, obj)
|
return b.BindUri(m, obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ShouldBindWith binds the passed struct pointer using the specified binding engine.
|
// ShouldBindWith binds the passed struct pointer using the specified binding engine.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user