matchesPath
Checks if a request path matches a configured endpoint path pattern.
This method splits both paths into segments and compares them one by one. Segments enclosed in curly braces ({ and }) in the config path are treated as parameters and match any value in the request path.
Algorithm
Split both paths by
/separatorFilter out empty segments (from leading/trailing slashes)
Check if segment counts match (if not, no match)
Compare each segment pair:
If config segment is a parameter (
{...}), it matches any request valueOtherwise, require exact string match (case-sensitive)
Return true only if all segments match
Performance
Time Complexity: O(n) where n is the number of path segments
Space Complexity: O(n) for storing segment lists
Typically very fast as API paths are short (usually < 10 segments)
Return
true if the request path matches the pattern, false otherwise
Parameters
The configured endpoint path pattern (may contain {parameters})
The actual incoming request path