format some codes style (#1165)

This commit is contained in:
田欧
2017-11-12 13:24:51 +08:00
committed by Bo-Yi Wu
parent 9ae1e5db2a
commit 9a4ecc87d6
4 changed files with 9 additions and 16 deletions

4
gin.go
View File

@ -403,8 +403,8 @@ func redirectTrailingSlash(c *Context) {
code = 307
}
if len(path) > 1 && path[len(path)-1] == '/' {
req.URL.Path = path[:len(path)-1]
if length := len(path); length > 1 && path[length-1] == '/' {
req.URL.Path = path[:length-1]
} else {
req.URL.Path = path + "/"
}