reverse pull request 397, it not a bug. Just should this way
Showing
1 changed file
with
4 additions
and
7 deletions
| ... | @@ -574,12 +574,10 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) | ... | @@ -574,12 +574,10 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) |
| 574 | n := len(requestPath) | 574 | n := len(requestPath) |
| 575 | if requestPath == route.pattern { | 575 | if requestPath == route.pattern { |
| 576 | runrouter = route.controllerType | 576 | runrouter = route.controllerType |
| 577 | runMethod = p.getRunMethod(r.Method, context, route) | ||
| 578 | if runMethod != "" { | ||
| 579 | findrouter = true | 577 | findrouter = true |
| 578 | runMethod = p.getRunMethod(r.Method, context, route) | ||
| 580 | break | 579 | break |
| 581 | } | 580 | } |
| 582 | } | ||
| 583 | // pattern /admin url /admin 200 /admin/ 404 | 581 | // pattern /admin url /admin 200 /admin/ 404 |
| 584 | // pattern /admin/ url /admin 301 /admin/ 200 | 582 | // pattern /admin/ url /admin 301 /admin/ 200 |
| 585 | if requestPath[n-1] != '/' && len(route.pattern) == n+1 && | 583 | if requestPath[n-1] != '/' && len(route.pattern) == n+1 && |
| ... | @@ -618,14 +616,12 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) | ... | @@ -618,14 +616,12 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) |
| 618 | r.URL.RawQuery = url.Values(values).Encode() | 616 | r.URL.RawQuery = url.Values(values).Encode() |
| 619 | } | 617 | } |
| 620 | runrouter = route.controllerType | 618 | runrouter = route.controllerType |
| 619 | findrouter = true | ||
| 621 | context.Input.Params = params | 620 | context.Input.Params = params |
| 622 | runMethod = p.getRunMethod(r.Method, context, route) | 621 | runMethod = p.getRunMethod(r.Method, context, route) |
| 623 | if runMethod != "" { | ||
| 624 | findrouter = true | ||
| 625 | break | 622 | break |
| 626 | } | 623 | } |
| 627 | } | 624 | } |
| 628 | } | ||
| 629 | 625 | ||
| 630 | if !findrouter && p.enableAuto { | 626 | if !findrouter && p.enableAuto { |
| 631 | // deal with url with diffirent ext | 627 | // deal with url with diffirent ext |
| ... | @@ -805,8 +801,9 @@ func (p *ControllerRegistor) getRunMethod(method string, context *beecontext.Con | ... | @@ -805,8 +801,9 @@ func (p *ControllerRegistor) getRunMethod(method string, context *beecontext.Con |
| 805 | return m | 801 | return m |
| 806 | } else if m, ok = router.methods["*"]; ok { | 802 | } else if m, ok = router.methods["*"]; ok { |
| 807 | return m | 803 | return m |
| 804 | } else { | ||
| 805 | return strings.Title(method) | ||
| 808 | } | 806 | } |
| 809 | return "" | ||
| 810 | } else { | 807 | } else { |
| 811 | return strings.Title(method) | 808 | return strings.Title(method) |
| 812 | } | 809 | } | ... | ... |
-
Please register or sign in to post a comment