RoutePatternMatch() — fiber Function Reference
Architecture documentation for the RoutePatternMatch() function in path.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD 335397e4_8345_d52d_8c66_df0b58f90500["RoutePatternMatch()"] bedec411_93e0_4024_219e_79649f60a9be["path.go"] 335397e4_8345_d52d_8c66_df0b58f90500 -->|defined in| bedec411_93e0_4024_219e_79649f60a9be 6c1d4745_edf7_f5dc_320c_f2116ceeca8d["parseRoute()"] 335397e4_8345_d52d_8c66_df0b58f90500 -->|calls| 6c1d4745_edf7_f5dc_320c_f2116ceeca8d ea017209_a08b_c99f_c9d5_f5929d799590["RemoveEscapeCharBytes()"] 335397e4_8345_d52d_8c66_df0b58f90500 -->|calls| ea017209_a08b_c99f_c9d5_f5929d799590 style 335397e4_8345_d52d_8c66_df0b58f90500 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
path.go lines 153–208
func RoutePatternMatch(path, pattern string, cfg ...Config) bool {
// See logic in (*Route).match and (*App).register
var ctxParams [maxParams]string
config := Config{}
if len(cfg) > 0 {
config = cfg[0]
}
if path == "" {
path = "/"
}
// Cannot have an empty pattern
if pattern == "" {
pattern = "/"
}
// Pattern always start with a '/'
if pattern[0] != '/' {
pattern = "/" + pattern
}
patternPretty := []byte(pattern)
// Case-sensitive routing, all to lowercase
if !config.CaseSensitive {
patternPretty = utils.ToLowerBytes(patternPretty)
path = utils.ToLower(path)
}
// Strict routing, remove trailing slashes
if !config.StrictRouting && len(patternPretty) > 1 {
patternPretty = utils.TrimRight(patternPretty, '/')
}
parser, _ := routerParserPool.Get().(*routeParser) //nolint:errcheck // only contains routeParser
parser.reset()
patternStr := string(patternPretty)
parser.parseRoute(patternStr)
defer routerParserPool.Put(parser)
// '*' wildcard matches any path
if (patternStr == "/" && path == "/") || patternStr == "/*" {
return true
}
// Does this route have parameters
if len(parser.params) > 0 {
if match := parser.getMatch(path, path, &ctxParams, false); match {
return true
}
}
// Check for a simple match
patternPretty = RemoveEscapeCharBytes(patternPretty)
return string(patternPretty) == path
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does RoutePatternMatch() do?
RoutePatternMatch() is a function in the fiber codebase, defined in path.go.
Where is RoutePatternMatch() defined?
RoutePatternMatch() is defined in path.go at line 153.
What does RoutePatternMatch() call?
RoutePatternMatch() calls 2 function(s): RemoveEscapeCharBytes, parseRoute.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free