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:
@ -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
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user