mirror of
https://github.com/yusing/godoxy.git
synced 2026-01-06 08:19:56 -06:00
fix(middleware): skip modify response for websocket and event-stream requests in ServeHTTP
This commit is contained in:
@@ -12,6 +12,7 @@ import (
|
||||
"github.com/yusing/godoxy/internal/route/rules"
|
||||
"github.com/yusing/godoxy/internal/serialization"
|
||||
gperr "github.com/yusing/goutils/errs"
|
||||
"github.com/yusing/goutils/http/httpheaders"
|
||||
"github.com/yusing/goutils/http/reverseproxy"
|
||||
)
|
||||
|
||||
@@ -190,6 +191,11 @@ func (m *Middleware) ServeHTTP(next http.HandlerFunc, w http.ResponseWriter, r *
|
||||
}
|
||||
}
|
||||
|
||||
if httpheaders.IsWebsocket(r.Header) || r.Header.Get("Accept") == "text/event-stream" {
|
||||
next(w, r)
|
||||
return
|
||||
}
|
||||
|
||||
if exec, ok := m.impl.(ResponseModifier); ok {
|
||||
rm := rules.NewResponseModifier(w)
|
||||
defer rm.FlushRelease()
|
||||
|
||||
Reference in New Issue
Block a user