diff --git a/context/httpRoute.go b/context/httpRoute.go index 161b5f0..b755d1a 100644 --- a/context/httpRoute.go +++ b/context/httpRoute.go @@ -76,7 +76,7 @@ func (receiver *HttpRoute) FormToParams(mapVal map[string]any) []reflect.Value { if exists { fieldVal := parse.ConvertValue(kv, dtoParamVal.Field(i).Type()) // dto中的字段赋值 - dtoParamVal.FieldByName(field.Name).Set(fieldVal) + dtoParamVal.FieldByName(field.Name).Set(reflect.ValueOf(fieldVal)) } } returnVal := []reflect.Value{dtoParamVal} diff --git a/controller/handleMiddleware.go b/controller/handleMiddleware.go index b531789..9532c5f 100644 --- a/controller/handleMiddleware.go +++ b/controller/handleMiddleware.go @@ -74,6 +74,6 @@ func (receiver HandleMiddleware) bindHeader(httpContext *context.HttpContext, co continue } headerValue := parse.ConvertValue(headerVal, headerFieldType) - headerFieldVal.Set(headerValue) + headerFieldVal.Set(reflect.ValueOf(headerValue)) } }