diff --git a/engine.go b/engine.go index fb18274..ff47fc3 100644 --- a/engine.go +++ b/engine.go @@ -202,21 +202,6 @@ func (engine *Engine) SetTLSServerConfigurator(fn func(*http.Server)) { engine.TLSServerConfigurator = fn } -// 是否开启末尾slash重定向 -func (engine *Engine) SetRedirectTrailingSlash(enable bool) { - engine.RedirectTrailingSlash = enable -} - -// 是否开启固定路径重定向 -func (engine *Engine) SetRedirectFixedPath(enable bool) { - engine.RedirectFixedPath = enable -} - -// 是否开启MethodNotAllowed -func (engine *Engine) SetHandleMethodNotAllowed(enable bool) { - engine.HandleMethodNotAllowed = enable -} - // SetLogger传入实例 func (engine *Engine) SetLogger(logger *reco.Logger) { engine.LogReco = logger @@ -949,34 +934,6 @@ func (group *RouterGroup) StaticFile(relativePath, filePath string) { group.OPTIONS(relativePath, FileHandle) } -// StaticFS -func (engine *Engine) StaticFS(relativePath string, fs http.FileSystem) { - // 清理路径 - relativePath = path.Clean(relativePath) - - // 确保相对路径以 '/' 结尾,以便 FileServer 正确处理子路径 - if !strings.HasSuffix(relativePath, "/") { - relativePath += "/" - } - - // 注册一个捕获所有路径的路由,使用 FileServer 处理器 - engine.ANY(relativePath+"*filepath", FileServer(fs)) -} - -// Group的StaticFS -func (group *RouterGroup) StaticFS(relativePath string, fs http.FileSystem) { - // 清理路径 - relativePath = path.Clean(relativePath) - - // 确保相对路径以 '/' 结尾,以便 FileServer 正确处理子路径 - if !strings.HasSuffix(relativePath, "/") { - relativePath += "/" - } - - // 注册一个捕获所有路径的路由,使用 FileServer 处理器 - group.ANY(relativePath+"*filepath", FileServer(fs)) -} - // 维护一个Methods列表 var ( MethodGet = "GET" diff --git a/go.mod b/go.mod index 4fb176d..74c947b 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.24.4 require ( github.com/WJQSERVER-STUDIO/go-utils/copyb v0.0.4 - github.com/WJQSERVER-STUDIO/httpc v0.7.1 + github.com/WJQSERVER-STUDIO/httpc v0.7.0 github.com/fenthope/reco v0.0.3 github.com/go-json-experiment/json v0.0.0-20250517221953-25912455fbc8 ) diff --git a/go.sum b/go.sum index 6e1be02..22fb00b 100644 --- a/go.sum +++ b/go.sum @@ -2,8 +2,6 @@ github.com/WJQSERVER-STUDIO/go-utils/copyb v0.0.4 h1:JLtFd00AdFg/TP+dtvIzLkdHwKU github.com/WJQSERVER-STUDIO/go-utils/copyb v0.0.4/go.mod h1:FZ6XE+4TKy4MOfX1xWKe6Rwsg0ucYFCdNh1KLvyKTfc= github.com/WJQSERVER-STUDIO/httpc v0.7.0 h1:iHhqlxppJBjlmvsIjvLZKRbWXqSdbeSGGofjHGmqGJc= github.com/WJQSERVER-STUDIO/httpc v0.7.0/go.mod h1:M7KNUZjjhCkzzcg9lBPs9YfkImI+7vqjAyjdA19+joE= -github.com/WJQSERVER-STUDIO/httpc v0.7.1 h1:D3NlfY52pwKIOSzkdRrLinUynyKELrcPZEO8QjlBq2M= -github.com/WJQSERVER-STUDIO/httpc v0.7.1/go.mod h1:M7KNUZjjhCkzzcg9lBPs9YfkImI+7vqjAyjdA19+joE= github.com/fenthope/reco v0.0.3 h1:RmnQ0D9a8PWtwOODawitTe4BztTnS9wYwrDbipISNq4= github.com/fenthope/reco v0.0.3/go.mod h1:mDkGLHte5udWTIcjQTxrABRcf56SSdxBOCLgrRDwI/Y= github.com/go-json-experiment/json v0.0.0-20250517221953-25912455fbc8 h1:o8UqXPI6SVwQt04RGsqKp3qqmbOfTNMqDrWsc4O47kk=