1
0
mirror of https://github.com/labstack/echo.git synced 2025-07-17 01:43:02 +02:00

Exposed DefaultHTTPErrorHandler function

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana
2015-05-28 16:50:49 -07:00
parent 7d518ce19d
commit 76e9b44190
4 changed files with 32 additions and 23 deletions

View File

@ -1,8 +1,9 @@
package middleware
import (
"github.com/labstack/echo"
"net/http"
"github.com/labstack/echo"
)
type (
@ -29,10 +30,9 @@ func StripTrailingSlash() echo.HandlerFunc {
func RedirectToSlash(opts ...RedirectToSlashOptions) echo.HandlerFunc {
code := http.StatusMovedPermanently
for _, o := range opts {
if o.Code != 0 {
code = o.Code
}
if len(opts) > 0 {
o := opts[0]
code = o.Code
}
return func(c *echo.Context) error {