From 60f83bb7bfd908a510a2399c3c1a13e9f3283c6e Mon Sep 17 00:00:00 2001 From: yusing Date: Wed, 29 Jan 2025 08:57:42 +0800 Subject: [PATCH] rules: remove the requirement of "path must start with /" --- internal/route/rules/on.go | 2 +- internal/route/rules/validate.go | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/internal/route/rules/on.go b/internal/route/rules/on.go index 8a80ac89..f2c64c85 100644 --- a/internal/route/rules/on.go +++ b/internal/route/rules/on.go @@ -145,7 +145,7 @@ var checkers = map[string]struct { /path/to /path/to/*`, args: map[string]string{ - "path": "the request path, must start with /", + "path": "the request path", }, }, validate: validateURLPath, diff --git a/internal/route/rules/validate.go b/internal/route/rules/validate.go index da728f91..818ce968 100644 --- a/internal/route/rules/validate.go +++ b/internal/route/rules/validate.go @@ -96,9 +96,6 @@ func validateURLPath(args []string) (any, E.Error) { if trailingSlash { p += "/" } - if p[0] != '/' { - return nil, ErrInvalidArguments.Withf("must start with /") - } return p, nil }