Experimenting with new validation library!!!

This commit is contained in:
Manu Mtz-Almeida
2015-04-07 12:30:16 +02:00
parent ea962038e1
commit ee3b67eda1
6 changed files with 13 additions and 88 deletions

View File

@ -18,9 +18,8 @@ func (_ jsonBinding) Name() string {
func (_ jsonBinding) Bind(req *http.Request, obj interface{}) error {
decoder := json.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)
}