1
0
mirror of https://github.com/labstack/echo.git synced 2025-07-05 00:58:47 +02:00

StripTrailingSlash is now an option

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana
2015-09-01 08:03:01 -07:00
parent 9b36defadf
commit 507c69ec80
8 changed files with 57 additions and 87 deletions

View File

@ -1,16 +0,0 @@
package middleware
import "github.com/labstack/echo"
// StripTrailingSlash returns a middleware which removes trailing slash from request
// path.
func StripTrailingSlash() echo.HandlerFunc {
return func(c *echo.Context) error {
p := c.Request().URL.Path
l := len(p)
if p[l-1] == '/' {
c.Request().URL.Path = p[:l-1]
}
return nil
}
}