fix bug
Showing
1 changed file
with
2 additions
and
1 deletions
| ... | @@ -69,6 +69,7 @@ func (p *ControllerRegistor) Add(pattern string, c ControllerInterface) { | ... | @@ -69,6 +69,7 @@ func (p *ControllerRegistor) Add(pattern string, c ControllerInterface) { |
| 69 | route := &controllerInfo{} | 69 | route := &controllerInfo{} |
| 70 | route.regex = regex | 70 | route.regex = regex |
| 71 | route.params = params | 71 | route.params = params |
| 72 | route.pattern = pattern | ||
| 72 | route.controllerType = t | 73 | route.controllerType = t |
| 73 | 74 | ||
| 74 | p.routers = append(p.routers, route) | 75 | p.routers = append(p.routers, route) |
| ... | @@ -146,7 +147,7 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) | ... | @@ -146,7 +147,7 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) |
| 146 | for _, route := range p.fixrouters { | 147 | for _, route := range p.fixrouters { |
| 147 | n := len(requestPath) | 148 | n := len(requestPath) |
| 148 | if (requestPath[n-1] != '/' && route.pattern == requestPath) || | 149 | if (requestPath[n-1] != '/' && route.pattern == requestPath) || |
| 149 | (len(route.pattern) >= n && requestPath[0:n] == route.pattern) { | 150 | (len(route.pattern) >= n && requestPath[0:n-1] == route.pattern) { |
| 150 | runrouter = route | 151 | runrouter = route |
| 151 | findrouter = true | 152 | findrouter = true |
| 152 | break | 153 | break | ... | ... |
-
Please register or sign in to post a comment