File tree Expand file tree Collapse file tree 1 file changed +4
-19
lines changed
http/middleware/validator Expand file tree Collapse file tree 1 file changed +4
-19
lines changed Original file line number Diff line number Diff line change @@ -60,32 +60,17 @@ func (m *Middleware) Validate(
6060 panic (ErrNilCreateValidateFn )
6161 }
6262
63- // Check if the type of the createValidateFn is a function and the parameters are correct
64- fnValuePtr , paramsValuesPtr , err := goreflect .CheckFunction (
65- createValidateFn ,
66- body ,
67- mapper ,
68- )
69- if err != nil {
70- panic (err )
71- }
72-
73- // Check if the parameters values are not nil
74- if paramsValuesPtr == nil {
75- panic (ErrNilParametersValues )
76- }
77- paramsValues := * paramsValuesPtr
78-
7963 return func (next http.Handler ) http.Handler {
8064 return http .HandlerFunc (
8165 func (w http.ResponseWriter , r * http.Request ) {
8266 // Get a new instance of the body
8367 dest := goreflect .NewInstanceFromType (bodyType )
8468
8569 // Call the validate function
86- results , err := goreflect .UnsafeCallFunction (
87- fnValuePtr ,
88- paramsValues ... ,
70+ results , err := goreflect .SafeCallFunction (
71+ createValidateFn ,
72+ dest ,
73+ mapper ,
8974 )
9075 if err != nil {
9176 panic (err )
You can’t perform that action at this time.
0 commit comments