From f78f06027e392f56459d0821c20405cdb1292028 Mon Sep 17 00:00:00 2001 From: springrain Date: Sat, 14 Aug 2021 19:37:03 +0800 Subject: [PATCH] SetBasePath To modify basePath --- gin.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gin.go b/gin.go index 6ab2be66..1920c435 100644 --- a/gin.go +++ b/gin.go @@ -318,6 +318,14 @@ func (engine *Engine) Routes() (routes RoutesInfo) { return routes } +// SetBasePath To modify basePath +func (engine *Engine) SetBasePath(basePath string) { + if len(basePath) < 1 { + return + } + engine.basePath = basePath +} + func iterate(path, method string, routes RoutesInfo, root *node) RoutesInfo { path += root.path if len(root.handlers) > 0 {