fix missing trailers with retry

This commit is contained in:
SALLEYRON Julien 2019-02-01 09:50:04 +01:00 committed by Traefiker Bot
parent 06905cb14a
commit db13dbdf46
4 changed files with 86 additions and 0 deletions

View file

@ -132,6 +132,7 @@ type responseWriterWithoutCloseNotify struct {
responseWriter http.ResponseWriter
headers http.Header
shouldRetry bool
written bool
}
func (r *responseWriterWithoutCloseNotify) ShouldRetry() bool {
@ -143,6 +144,9 @@ func (r *responseWriterWithoutCloseNotify) DisableRetries() {
}
func (r *responseWriterWithoutCloseNotify) Header() http.Header {
if r.written {
return r.responseWriter.Header()
}
return r.headers
}
@ -177,6 +181,7 @@ func (r *responseWriterWithoutCloseNotify) WriteHeader(code int) {
}
r.responseWriter.WriteHeader(code)
r.written = true
}
func (r *responseWriterWithoutCloseNotify) Hijack() (net.Conn, *bufio.ReadWriter, error) {