File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -15,11 +15,12 @@ func newSubRouter(basePath string, root *httpRouter) *subRouter {
1515}
1616
1717type subRouter struct {
18- basePath string
19- resourceName string
20- root * httpRouter
21- labels []* router.Label
22- middlewareChain []router.Middleware
18+ basePath string
19+ resourceName string
20+ resourceBasePath string
21+ root * httpRouter
22+ labels []* router.Label
23+ middlewareChain []router.Middleware
2324}
2425
2526func (r * subRouter ) Use (m router.Middleware ) {
@@ -78,15 +79,16 @@ func (r *subRouter) SetLabel(labels ...*router.Label) {
7879
7980func (r * subRouter ) ResourceRouter (resourceName string , labels ... * router.Label ) router.ResourceRouter {
8081 return & subRouter {
81- resourceName : resourceName ,
82- basePath : r .basePath ,
83- root : r .root ,
84- labels : append (r .labels , labels ... ),
82+ resourceName : resourceName ,
83+ resourceBasePath : r .basePath ,
84+ basePath : r .basePath ,
85+ root : r .root ,
86+ labels : append (r .labels , labels ... ),
8587 }
8688}
8789
8890func (r * subRouter ) BasePath (path string ) {
89- r .basePath += "/" + path
91+ r .basePath = r . resourceBasePath + "/" + path
9092}
9193
9294func (r * subRouter ) add (e * entry ) {
You can’t perform that action at this time.
0 commit comments