func AddTrailingSlashWithConfig(config TrailingSlashConfig) echo.MiddlewareFunc {
	return func(next echo.HandlerFunc) echo.HandlerFunc {
		return func(c echo.Context) error {
			req := c.Request()
			url := req.URL()
			path := url.Path()
			qs := url.QueryString()
			if path != "/" && path[len(path)-1] != '/' {
				path += "/"
				uri := path
				if qs != "" {
					uri += "?" + qs
				}
				if config.RedirectCode != 0 {
					return c.Redirect(config.RedirectCode, uri)
				}
				req.SetURI(uri)
				url.SetPath(path)
			}
			return next(c)
		}
	}
}
AddTrailingSlashWithConfig returns a AddTrailingSlash middleware from config.
See `AddTrailingSlash()`.
package middleware
import (
	"github.com/labstack/echo"
)
type (
	TrailingSlashConfig struct {
		RedirectCode int `json:"redirect_code"`
	}
)
func AddTrailingSlash() echo.MiddlewareFunc {
	return AddTrailingSlashWithConfig(TrailingSlashConfig{})
}