File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -179,18 +179,18 @@ type (
179
179
)
180
180
181
181
func (cv *CustomValidator ) Validate (i interface {}) error {
182
- return echo. NewHTTPError (http. StatusInternalServerError , cv.validator .Struct (i). Error () )
182
+ return cv.validator .Struct (i)
183
183
}
184
184
185
185
func main () {
186
186
e := echo.New ()
187
187
e.Validator = &CustomValidator{validator: validator.New ()}
188
188
e.POST (" /users" , func (c echo.Context ) (err error ) {
189
189
u := new (User)
190
- if err = c.Bind (u); err != nil {
190
+ if err : = c.Bind (u); err != nil {
191
191
return echo.NewHTTPError (http.StatusBadRequest , err.Error ())
192
192
}
193
- if err = c.Validate (u); err != nil {
193
+ if err : = c.Validate (u); err != nil {
194
194
return echo.NewHTTPError (http.StatusBadRequest , err.Error ())
195
195
}
196
196
return c.JSON (http.StatusOK , u)
You can’t perform that action at this time.
0 commit comments