mirror of
https://github.com/gin-gonic/gin.git
synced 2025-08-06 07:40:39 +08:00
Experimenting with new validation library!!!
This commit is contained in:
@ -17,9 +17,8 @@ func (_ xmlBinding) Name() string {
|
||||
|
||||
func (_ xmlBinding) Bind(req *http.Request, obj interface{}) error {
|
||||
decoder := xml.NewDecoder(req.Body)
|
||||
if err := decoder.Decode(obj); err == nil {
|
||||
return Validate(obj)
|
||||
} else {
|
||||
if err := decoder.Decode(obj); err != nil {
|
||||
return err
|
||||
}
|
||||
return _validator.ValidateStruct(obj)
|
||||
}
|
||||
|
Reference in New Issue
Block a user