Skip to content

Commit

Permalink
fix #2215
Browse files Browse the repository at this point in the history
  • Loading branch information
kataras committed Sep 25, 2023
1 parent e7b4039 commit f955489
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions core/router/api_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,10 @@ func (api *APIBuilder) Handle(method string, relativePath string, handlers ...co
// handle registers a full route to this Party.
// Use Handle or Get, Post, Put, Delete and et.c. instead.
func (api *APIBuilder) handle(errorCode int, method string, relativePath string, handlers ...context.Handler) *Route {
if relativePath == "" {
relativePath = "/"
}

routes := api.createRoutes(errorCode, []string{method}, relativePath, handlers...)

var route *Route // the last one is returned.
Expand Down Expand Up @@ -832,6 +836,10 @@ func removeDuplicates(elements []string) (result []string) {
// use the `Subdomain` or `WildcardSubdomain` methods
// or pass a "relativePath" of "admin." or "*." respectfully.
func (api *APIBuilder) Party(relativePath string, handlers ...context.Handler) Party {
if relativePath == "" {
relativePath = "/"
}

// if app.Party("/"), root party or app.Party("/user") == app.Party("/user")
// then just add the middlewares and return itself.
// if relativePath == "" || api.relativePath == relativePath {
Expand Down

0 comments on commit f955489

Please sign in to comment.