Updated echo to use the latest version
This commit is contained in:
20
vendor/github.com/labstack/echo/v4/bind.go
generated
vendored
20
vendor/github.com/labstack/echo/v4/bind.go
generated
vendored
@ -34,17 +34,14 @@ type (
|
||||
func (b *DefaultBinder) Bind(i interface{}, c Context) (err error) {
|
||||
req := c.Request()
|
||||
|
||||
paramNames := c.ParamNames()
|
||||
paramValues := c.ParamValues()
|
||||
params := make(map[string][]string)
|
||||
for in, name := range paramNames {
|
||||
params[name] = []string{paramValues[in]}
|
||||
names := c.ParamNames()
|
||||
values := c.ParamValues()
|
||||
params := map[string][]string{}
|
||||
for i, name := range names {
|
||||
params[name] = []string{values[i]}
|
||||
}
|
||||
// Only bind the params to the struct if there is something to bind
|
||||
if len(params) > 0 {
|
||||
if err := b.bindData(i, params, "param"); err != nil {
|
||||
return NewHTTPError(http.StatusBadRequest, err.Error()).SetInternal(err)
|
||||
}
|
||||
if err := b.bindData(i, params, "param"); err != nil {
|
||||
return NewHTTPError(http.StatusBadRequest, err.Error()).SetInternal(err)
|
||||
}
|
||||
|
||||
if req.ContentLength == 0 {
|
||||
@ -91,6 +88,9 @@ func (b *DefaultBinder) Bind(i interface{}, c Context) (err error) {
|
||||
}
|
||||
|
||||
func (b *DefaultBinder) bindData(ptr interface{}, data map[string][]string, tag string) error {
|
||||
if len(data) == 0 {
|
||||
return nil
|
||||
}
|
||||
typ := reflect.TypeOf(ptr).Elem()
|
||||
val := reflect.ValueOf(ptr).Elem()
|
||||
|
||||
|
Reference in New Issue
Block a user