Experimenting with new validation library!!!
This commit is contained in:
+2
-3
@@ -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