We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ecce3d5 commit 03799a5Copy full SHA for 03799a5
http/middleware/validator/middleware.go
@@ -6,6 +6,7 @@ import (
6
goreflect "github.com/ralvarezdev/go-reflect"
7
govalidatorstructmapper "github.com/ralvarezdev/go-validator/struct/mapper"
8
"net/http"
9
+ "reflect"
10
)
11
12
// Middleware struct
@@ -41,6 +42,11 @@ func (m *Middleware) Validate(
41
42
// Get the type of the body
43
bodyType := goreflect.GetTypeOf(body)
44
45
+ // Dereference the body type if it is a pointer
46
+ if bodyType.Kind() == reflect.Pointer {
47
+ bodyType = bodyType.Elem()
48
+ }
49
+
50
// Create the mapper
51
mapper, err := m.generator.NewMapper(body)
52
if err != nil {
0 commit comments