Skip to content

Commit b06a235

Browse files
authored
fix request validator example then payload is valid (#181) (#182)
1 parent 6d389fd commit b06a235

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

website/content/guide/request.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,10 @@ type (
9696
)
9797

9898
func (cv *CustomValidator) Validate(i interface{}) error {
99-
return echo.NewHTTPError(http.StatusInternalServerError, cv.validator.Struct(i).Error())
99+
if err := cv.validator.Struct(i); err != nil {
100+
return echo.NewHTTPError(http.StatusInternalServerError, err.Error())
101+
}
102+
return nil
100103
}
101104

102105
func main() {

0 commit comments

Comments
 (0)