@@ -448,9 +448,12 @@ var pathReplacer = strings.NewReplacer(
448
448
"}" , "_" ,
449
449
)
450
450
451
- func getNameFromPathAndVerb (verb , path string ) string {
452
- return strings .ToLower (verb ) + "_" +
453
- pathReplacer .Replace (strings .TrimPrefix (strings .TrimRight (path , "/" ), "/api/_version_/fleet/" ))
451
+ func getNameFromPathAndVerb (verb , path , startAt string ) string {
452
+ prefix := strings .ToLower (verb ) + "_"
453
+ if startAt != "" {
454
+ prefix += pathReplacer .Replace (startAt ) + "_"
455
+ }
456
+ return prefix + pathReplacer .Replace (strings .TrimPrefix (strings .TrimRight (path , "/" ), "/api/_version_/fleet/" ))
454
457
}
455
458
456
459
func capabilitiesResponseFunc (capabilities fleet.CapabilityMap ) kithttp.ServerOption {
@@ -560,14 +563,14 @@ func (e *authEndpointer) handlePathHandler(path string, pathHandler func(path st
560
563
}
561
564
562
565
versionedPath := strings .Replace (path , "/_version_/" , fmt .Sprintf ("/{fleetversion:(?:%s)}/" , strings .Join (versions , "|" )), 1 )
563
- nameAndVerb := getNameFromPathAndVerb (verb , path )
566
+ nameAndVerb := getNameFromPathAndVerb (verb , path , e . startingAtVersion )
564
567
if e .usePathPrefix {
565
568
e .r .PathPrefix (versionedPath ).Handler (pathHandler (versionedPath )).Name (nameAndVerb ).Methods (verb )
566
569
} else {
567
570
e .r .Handle (versionedPath , pathHandler (versionedPath )).Name (nameAndVerb ).Methods (verb )
568
571
}
569
572
for _ , alias := range e .alternativePaths {
570
- nameAndVerb := getNameFromPathAndVerb (verb , alias )
573
+ nameAndVerb := getNameFromPathAndVerb (verb , alias , e . startingAtVersion )
571
574
versionedPath := strings .Replace (alias , "/_version_/" , fmt .Sprintf ("/{fleetversion:(?:%s)}/" , strings .Join (versions , "|" )), 1 )
572
575
if e .usePathPrefix {
573
576
e .r .PathPrefix (versionedPath ).Handler (pathHandler (versionedPath )).Name (nameAndVerb ).Methods (verb )
0 commit comments