delete else

This commit is contained in:
thinkerou 2017-06-13 11:29:28 +08:00
parent 53799774f4
commit 967ca40346
2 changed files with 4 additions and 3 deletions

4
gin.go
View File

@ -326,8 +326,8 @@ func (engine *Engine) handleHTTPRequest(context *Context) {
context.Next()
context.writermem.WriteHeaderNow()
return
} else if httpMethod != "CONNECT" && path != "/" {
}
if httpMethod != "CONNECT" && path != "/" {
if tsr && engine.RedirectTrailingSlash {
redirectTrailingSlash(context)
return

View File

@ -432,7 +432,8 @@ walk: // Outer loop for walking the tree
if handlers = n.handlers; handlers != nil {
return
} else if len(n.children) == 1 {
}
if len(n.children) == 1 {
// No handle found. Check if a handle for this path + a
// trailing slash exists for TSR recommendation
n = n.children[0]