Ensure redirector supports Hijacking if possible

This commit is contained in:
Darren Shepherd 2020-02-28 09:30:25 -07:00
parent 9da27b7130
commit 68ed467231

View File

@ -18,6 +18,9 @@ func RedirectRewrite(next http.Handler) http.Handler {
ResponseWriter: rw,
prefix: prefix,
}
if h, ok := rw.(http.Hijacker); ok {
r.Hijacker = h
}
next.ServeHTTP(r, req)
r.Close()
})
@ -25,6 +28,7 @@ func RedirectRewrite(next http.Handler) http.Handler {
type redirector struct {
http.ResponseWriter
http.Hijacker
prefix string
from, to string
tempBuffer *bytes.Buffer