mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-17 05:59:42 +02:00
fix(fileserver): correct middleware handler to avoid self recursion
This commit is contained in:
@@ -71,8 +71,9 @@ func (s *FileServer) Start(parent task.Parent) gperr.Error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if s.middleware != nil {
|
if s.middleware != nil {
|
||||||
|
next := s.handler
|
||||||
s.handler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
s.handler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
s.middleware.ServeHTTP(s.handler.ServeHTTP, w, r)
|
s.middleware.ServeHTTP(next.ServeHTTP, w, r)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user