diff --git a/net/http/mux.go b/net/http/mux.go index 8e6e394..cda99fa 100644 --- a/net/http/mux.go +++ b/net/http/mux.go @@ -84,9 +84,9 @@ func (r *route) match(ctx context.Context, router *ServeMux, segs []string) (con return nil, false } isParam := false - if strings.HasPrefix(seg, ":") { + if strings.HasPrefix(seg, "{") { isParam = true - seg = strings.TrimPrefix(seg, ":") + seg = strings.Trim(seg, "{}") } if !isParam { // verbatim check if strings.HasSuffix(seg, "...") { diff --git a/net/http/mux_test.go b/net/http/mux_test.go index 85602c7..2c2b311 100644 --- a/net/http/mux_test.go +++ b/net/http/mux_test.go @@ -116,11 +116,11 @@ var tests = []struct { }, // path params { - "/path-param/:id", + "/path-param/{id}", "GET", "/path-param/123", true, map[string]string{"id": "123"}, }, { - "/path-params/:era/:group/:member", + "/path-params/{era}/{group}/{member}", "GET", "/path-params/60s/beatles/lennon", true, map[string]string{ "era": "60s", "group": "beatles", @@ -128,7 +128,7 @@ var tests = []struct { }, }, { - "/path-params-prefix/:era/:group/:member/", + "/path-params-prefix/{era}/{group}/{member}/", "GET", "/path-params-prefix/60s/beatles/lennon/yoko", true, map[string]string{ "era": "60s", "group": "beatles",