1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-22 04:17:03 +00:00

asthetics

Former-commit-id: 1b13823e4e31327dad280a82252be969f845efe8
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-06-10 23:37:50 +03:00
parent 05ae7792df
commit 07f678eac0
6 changed files with 127 additions and 68 deletions

View File

@@ -258,6 +258,19 @@ func splitSubdomainAndPath(fullUnparsedPath string) (subdomain string, path stri
return // return subdomain without slash, path with slash
}
func staticPath(src string) string {
bidx := strings.IndexByte(src, '{')
if bidx == -1 || len(src) <= bidx {
return src // no dynamic part found
}
if bidx <= 1 { // found at first{...} or second index (/{...}),
// although first index should never happen because of the prepended slash.
return "/"
}
return src[:bidx-1] // (/static/{...} -> /static)
}
// RoutePathReverserOption option signature for the RoutePathReverser.
type RoutePathReverserOption func(*RoutePathReverser)