resolveResourcePath returns the externally visible resource path, restoring the configured base path when proxies strip it before forwarding.
(path, basePath string)
| 168 | // resolveResourcePath returns the externally visible resource path, |
| 169 | // restoring the configured base path when proxies strip it before forwarding. |
| 170 | func resolveResourcePath(path, basePath string) string { |
| 171 | if path == "" { |
| 172 | path = "/" |
| 173 | } |
| 174 | base := normalizeBasePath(basePath) |
| 175 | if base == "" { |
| 176 | return path |
| 177 | } |
| 178 | if path == "/" { |
| 179 | return base |
| 180 | } |
| 181 | if path == base || strings.HasPrefix(path, base+"/") { |
| 182 | return path |
| 183 | } |
| 184 | return base + path |
| 185 | } |
| 186 | |
| 187 | // ResolveResourcePath returns the externally visible resource path for a request. |
| 188 | // Exported for use by middleware. |
no test coverage detected