mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-15 21:06:39 +08:00
Update form_mapping#mapForm to support reflect.Ptr
Added reflect for ptr types to support the go-swagger generated http clients.
This commit is contained in:
parent
00b10c30a0
commit
50ed42ef27
@ -90,8 +90,10 @@ func setWithProperType(valueKind reflect.Kind, val string, structField reflect.V
|
||||
return setFloatField(val, 64, structField)
|
||||
case reflect.String:
|
||||
structField.SetString(val)
|
||||
case reflect.Ptr:
|
||||
structField.Set(reflect.ValueOf(&val))
|
||||
default:
|
||||
return errors.New("Unknown type")
|
||||
return fmt.Errorf("Unknown type: %s", valueKind)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user