mirror of
https://github.com/infinite-iroha/touka.git
synced 2026-02-03 17:01:11 +08:00
Compare commits
No commits in common. "9ec1d1f2c6716e5ed2e9587fa06b2b5845c77c63" and "543b3165ca68dc81d17f657adcb13477685f6754" have entirely different histories.
9ec1d1f2c6
...
543b3165ca
3 changed files with 1 additions and 46 deletions
43
engine.go
43
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"
|
||||
|
|
|
|||
2
go.mod
2
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
|
||||
)
|
||||
|
|
|
|||
2
go.sum
2
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=
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue