fix router's bug when requestpath only have one character
Showing
1 changed file
with
1 additions
and
1 deletions
| ... | @@ -249,7 +249,7 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) | ... | @@ -249,7 +249,7 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) |
| 249 | } | 249 | } |
| 250 | 250 | ||
| 251 | if (requestPath[n-1] != '/' && route.pattern == requestPath) || | 251 | if (requestPath[n-1] != '/' && route.pattern == requestPath) || |
| 252 | (len(route.pattern) >= n-1 && requestPath[0:n-1] == route.pattern) { | 252 | (requestPath[n-1] == '/' && len(route.pattern) >= n-1 && requestPath[0:n-1] == route.pattern) { |
| 253 | runrouter = route | 253 | runrouter = route |
| 254 | findrouter = true | 254 | findrouter = true |
| 255 | break | 255 | break | ... | ... |
-
Please register or sign in to post a comment