1
0
mirror of https://github.com/labstack/echo.git synced 2025-11-29 22:48:07 +02:00

Encapsulated fields and exposed public functions.

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana
2015-05-22 04:40:01 -07:00
parent df924ffc11
commit bf85c56b08
13 changed files with 108 additions and 82 deletions

View File

@@ -15,10 +15,10 @@ type (
// path.
func StripTrailingSlash() echo.HandlerFunc {
return func(c *echo.Context) error {
p := c.Request.URL.Path
p := c.Request().URL.Path
l := len(p)
if p[l-1] == '/' {
c.Request.URL.Path = p[:l-1]
c.Request().URL.Path = p[:l-1]
}
return nil
}
@@ -36,7 +36,7 @@ func RedirectToSlash(opts ...RedirectToSlashOptions) echo.HandlerFunc {
}
return func(c *echo.Context) error {
p := c.Request.URL.Path
p := c.Request().URL.Path
l := len(p)
if p[l-1] != '/' {
c.Redirect(code, p+"/")