remove nonuse parseForm and change the StructMap's params
Showing
1 changed file
with
3 additions
and
5 deletions
| ... | @@ -188,9 +188,8 @@ func (p *ControllerRegistor) FilterPrefixPath(path string, filter http.HandlerFu | ... | @@ -188,9 +188,8 @@ func (p *ControllerRegistor) FilterPrefixPath(path string, filter http.HandlerFu |
| 188 | }) | 188 | }) |
| 189 | } | 189 | } |
| 190 | 190 | ||
| 191 | func StructMap(vc reflect.Value, params *url.Values) error { | 191 | func StructMap(vc reflect.Value, r *http.Request) error { |
| 192 | 192 | for k, t := range r.Form { | |
| 193 | for k, t := range *params { | ||
| 194 | v := t[0] | 193 | v := t[0] |
| 195 | names := strings.Split(k, ".") | 194 | names := strings.Split(k, ".") |
| 196 | var value reflect.Value = vc | 195 | var value reflect.Value = vc |
| ... | @@ -432,8 +431,7 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) | ... | @@ -432,8 +431,7 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) |
| 432 | //Invoke the request handler | 431 | //Invoke the request handler |
| 433 | vc := reflect.New(runrouter.controllerType) | 432 | vc := reflect.New(runrouter.controllerType) |
| 434 | 433 | ||
| 435 | r.ParseForm() | 434 | StructMap(vc.Elem(), &r) |
| 436 | StructMap(vc.Elem(), &r.Form) | ||
| 437 | 435 | ||
| 438 | //call the controller init function | 436 | //call the controller init function |
| 439 | init := vc.MethodByName("Init") | 437 | init := vc.MethodByName("Init") | ... | ... |
-
Please register or sign in to post a comment