FullPaths returns the endpoint full paths computed by concatenating the service base paths with the route specific path.
()
| 1081 | // FullPaths returns the endpoint full paths computed by concatenating the |
| 1082 | // service base paths with the route specific path. |
| 1083 | func (r *RouteExpr) FullPaths() []string { |
| 1084 | if r.IsAbsolute() { |
| 1085 | return []string{httppath.Clean(r.Path[1:])} |
| 1086 | } |
| 1087 | bases := r.Endpoint.Service.FullPaths() |
| 1088 | res := make([]string, len(bases)) |
| 1089 | for i, b := range bases { |
| 1090 | res[i] = httppath.Clean(path.Join(b, r.Path)) |
| 1091 | if res[i] == "/" { |
| 1092 | continue |
| 1093 | } |
| 1094 | // path has trailing slash |
| 1095 | if r.Path == "/" && strings.HasSuffix(b, "/") { |
| 1096 | res[i] += "/" |
| 1097 | } else if r.Path != "/" && strings.HasSuffix(r.Path, "/") { |
| 1098 | res[i] += "/" |
| 1099 | } |
| 1100 | } |
| 1101 | return res |
| 1102 | } |
| 1103 | |
| 1104 | // IsAbsolute returns true if the endpoint path should not be concatenated to |
| 1105 | // the service and API base paths. |
no test coverage detected