diff --git a/pkg/api/collect.go b/pkg/api/collect.go index 7866603..a285611 100644 --- a/pkg/api/collect.go +++ b/pkg/api/collect.go @@ -207,7 +207,7 @@ func shouldCollect(r *http.Request) bool { } func parsePathname(p string) string { - return "/" + strings.TrimLeft(p, "/") + return "/" + strings.TrimLeft(strings.TrimRight(p, "/"), "/") } func parseHostname(r string) string { diff --git a/pkg/api/collect_test.go b/pkg/api/collect_test.go index 3ee0324..f4b3a52 100644 --- a/pkg/api/collect_test.go +++ b/pkg/api/collect_test.go @@ -22,6 +22,9 @@ func TestParsePathname(t *testing.T) { if v := parsePathname("about"); v != "/about" { t.Errorf("error parsing pathname. expected %#v, got %#v", "/about", v) } + if v := parsePathname("about/"); v != "/about" { + t.Errorf("error parsing pathname. expected %#v, got %#v", "/about", v) + } } func TestParseHostname(t *testing.T) {