From f955489f3a5bcb96fa427c213c053ecec2e4b054 Mon Sep 17 00:00:00 2001 From: "Gerasimos (Makis) Maropoulos" Date: Mon, 25 Sep 2023 19:30:48 +0300 Subject: [PATCH] fix #2215 --- core/router/api_builder.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/router/api_builder.go b/core/router/api_builder.go index 26f1e62f..fa2b6dad 100644 --- a/core/router/api_builder.go +++ b/core/router/api_builder.go @@ -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. @@ -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 {