mirror of
https://github.com/infinite-iroha/touka.git
synced 2026-02-03 17:01:11 +08:00
Compare commits
No commits in common. "6c96e189d35479010d500dae1251444095038999" and "7733dc80cdd70375c61cbc14411d45f29b362096" have entirely different histories.
6c96e189d3
...
7733dc80cd
1 changed files with 0 additions and 43 deletions
43
engine.go
43
engine.go
|
|
@ -202,21 +202,6 @@ func (engine *Engine) SetTLSServerConfigurator(fn func(*http.Server)) {
|
||||||
engine.TLSServerConfigurator = fn
|
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传入实例
|
// SetLogger传入实例
|
||||||
func (engine *Engine) SetLogger(logger *reco.Logger) {
|
func (engine *Engine) SetLogger(logger *reco.Logger) {
|
||||||
engine.LogReco = logger
|
engine.LogReco = logger
|
||||||
|
|
@ -949,34 +934,6 @@ func (group *RouterGroup) StaticFile(relativePath, filePath string) {
|
||||||
group.OPTIONS(relativePath, FileHandle)
|
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列表
|
// 维护一个Methods列表
|
||||||
var (
|
var (
|
||||||
MethodGet = "GET"
|
MethodGet = "GET"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue