diff --git a/matcher.go b/matcher.go index 816fc1f..a9f7471 100644 --- a/matcher.go +++ b/matcher.go @@ -170,9 +170,5 @@ func replaceParams(to string, matched urlpath.Match) string { } func replaceSplat(to string, matched urlpath.Match) string { - if matched.Trailing != "" { - to = strings.ReplaceAll(to, ":splat", matched.Trailing) - } - - return to + return strings.ReplaceAll(to, ":splat", matched.Trailing) } diff --git a/matcher_test.go b/matcher_test.go index e949bfd..c520ef9 100644 --- a/matcher_test.go +++ b/matcher_test.go @@ -30,6 +30,7 @@ func TestRedirects(t *testing.T) { /accommodation/* /accommodation/ 200 http://one.test:2021/* http://two.test:2021/:splat + https://lch.k8.rentivo.com/* https://lakecomohomes.com/:splat one.test:/2021/no-scheme two.test:2021/:splat `)) @@ -96,6 +97,18 @@ func TestRedirects(t *testing.T) { true, "http://two.test:2021/redirect/foobar", }, + { + MustParseUrl("https://lch.k8.rentivo.com/example"), + true, + true, + "https://lakecomohomes.com/example", + }, + { + MustParseUrl("https://lch.k8.rentivo.com/"), + true, + true, + "https://lakecomohomes.com/", + }, } ctx := &MatchContext{