matchers.go
func redirectPath(path string, r *http.Request) http.Handler {
	t1 := strings.HasSuffix(path, "/")
	t2 := strings.HasSuffix(r.URL.Path, "/")
	if t1 != t2 {
		u, _ := url.Parse(r.URL.String())
		if t1 {
			u.Path += "/"
		} else {
			u.Path = u.Path[:len(u.Path)-1]
		}
		return http.RedirectHandler(u.String(), 301)
	}
	return nil
}
func redirectPath(path string, r *http.Request) http.Handler {
	t1 := strings.HasSuffix(path, "/")
	t2 := strings.HasSuffix(r.URL.Path, "/")
	if t1 != t2 {
		u, _ := url.Parse(r.URL.String())
		if t1 {
			u.Path += "/"
		} else {
			u.Path = u.Path[:len(u.Path)-1]
		}
		return http.RedirectHandler(u.String(), 301)
	}
	return nil
}
func redirectPath ( path string , r * http . Request ) http . Handler { t1 := strings . HasSuffix ( path , " " ) t2 := strings . HasSuffix ( r . URL . Path , " " ) if t1 != t2 { u , _ := url . Parse ( r . URL . String ( ) ) if t1 { u . Path += " " } else { u . Path = u . Path [ : len ( u . Path ) - 1 ] } return http . RedirectHandler ( u . String ( ) , 301 ) } return nil }
// redirectPath returns a handler that redirects if the path trailing slash
// differs from the request URL path.
redirectPath returns a handler that redirects if the path trailing slash differs from the request URL path .