MCPcopy
hub / github.com/go-chi/chi / replaceWildcards

Function replaceWildcards

context.go:139–144  ·  view source on GitHub ↗

replaceWildcards takes a route pattern and replaces all occurrences of "/*/" with "/". It iteratively runs until no wildcards remain to correctly handle consecutive wildcards.

(p string)

Source from the content-addressed store, hash-verified

137// "/*/" with "/". It iteratively runs until no wildcards remain to
138// correctly handle consecutive wildcards.
139func replaceWildcards(p string) string {
140 for strings.Contains(p, "/*/") {
141 p = strings.ReplaceAll(p, "/*/", "/")
142 }
143 return p
144}
145
146// RouteParams is a structure to track URL routing parameters efficiently.
147type RouteParams struct {

Callers 2

RoutePatternMethod · 0.85

Calls

no outgoing calls

Tested by 1