1
0
Fork 0

CloseNotifier: return pointer instead of value

This commit is contained in:
mpl 2019-12-12 15:12:05 +01:00 committed by Traefiker Bot
parent e2982185d6
commit 61e59d74e0
4 changed files with 95 additions and 17 deletions

View file

@ -10,7 +10,7 @@ import (
)
var (
_ middlewares.Stateful = &captureResponseWriter{}
_ middlewares.Stateful = &captureResponseWriterWithCloseNotify{}
)
type capturer interface {
@ -24,7 +24,7 @@ func newCaptureResponseWriter(rw http.ResponseWriter) capturer {
if _, ok := rw.(http.CloseNotifier); !ok {
return capt
}
return captureResponseWriterWithCloseNotify{capt}
return &captureResponseWriterWithCloseNotify{capt}
}
// captureResponseWriter is a wrapper of type http.ResponseWriter
@ -76,13 +76,6 @@ func (crw *captureResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error)
return nil, nil, fmt.Errorf("not a hijacker: %T", crw.rw)
}
func (crw *captureResponseWriter) CloseNotify() <-chan bool {
if c, ok := crw.rw.(http.CloseNotifier); ok {
return c.CloseNotify()
}
return nil
}
func (crw *captureResponseWriter) Status() int {
return crw.status
}