Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanPath ¶
CleanPath is the URL version of path.Clean, it returns a canonical URL path for p, eliminating . and .. elements.
The following rules are applied iteratively until no further processing can be done:
- Replace multiple slashes with a single slash.
- Eliminate each . path name element (the current directory).
- Eliminate each inner .. path name element (the parent directory) along with the non-.. element that precedes it.
- Eliminate .. elements that begin a rooted path: that is, replace "/.." by "/" at the beginning of a path.
If the result of this process is an empty string, "/" is returned
func CompilePath ¶
CompilePath compile usual HTTP endpoint path to a canonical regex based path for categorizing exact endpoint path, wildcard and path params. It output the canonical regular expression to match the path, and the path param names The following process are applied:
Remove / ignore trailing / and /*
Adding a leading / to ensure canonical path had leading /
Remove all special meta character in the path (via regex QuoteMeta)
Escape all / into \\/
Extract all path param (ex: /path/:id => id is path param)
Also extract if wildcards exist in path (ex: /path/*)
Types ¶
This section is empty.