Use MarkLongPolling instead of hard-coded route path (#37427)

This commit is contained in:
wxiaoguang
2026-04-26 19:42:29 +08:00
committed by GitHub
parent ebf30ac4db
commit 712b3a54b5
10 changed files with 73 additions and 42 deletions
+2 -2
View File
@@ -87,6 +87,7 @@ func getViteDevProxy() *httputil.ReverseProxy {
// the Vite dev server port from the port file written by the viteDevServerPortPlugin.
// It is needed because there are container-based development, only Gitea web server's port is exposed.
func ViteDevMiddleware(next http.Handler) http.Handler {
markLongPolling := routing.MarkLongPolling()
return http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) {
if !isViteDevRequest(req) {
next.ServeHTTP(resp, req)
@@ -97,8 +98,7 @@ func ViteDevMiddleware(next http.Handler) http.Handler {
next.ServeHTTP(resp, req)
return
}
routing.MarkLongPolling(resp, req)
proxy.ServeHTTP(resp, req)
markLongPolling(proxy).ServeHTTP(resp, req)
})
}