feat: ignore rest.WithPrefix on empty prefix (#1208)

master
Kevin Wan 3 years ago committed by GitHub
parent 539215d7df
commit 4d22b0c497
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -207,10 +207,12 @@ func getRoutes(api *spec.ApiSpec) ([]group, error) {
strings.Split(middleware, ",")...) strings.Split(middleware, ",")...)
} }
prefix := g.GetAnnotation(spec.RoutePrefixKey) prefix := g.GetAnnotation(spec.RoutePrefixKey)
prefix = strings.TrimSpace(prefix)
prefix = strings.ReplaceAll(prefix, `"`, "") prefix = strings.ReplaceAll(prefix, `"`, "")
prefix = strings.TrimSpace(prefix)
if len(prefix) > 0 {
prefix = path.Join("/", prefix) prefix = path.Join("/", prefix)
groupedRoutes.prefix = prefix groupedRoutes.prefix = prefix
}
routes = append(routes, groupedRoutes) routes = append(routes, groupedRoutes)
} }

Loading…
Cancel
Save