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

@ -110,6 +110,7 @@ type retryResponseWriterWithoutCloseNotify struct {
responseWriter http.ResponseWriter
headers http.Header
shouldRetry bool
written bool
}
func (rr *retryResponseWriterWithoutCloseNotify) ShouldRetry() bool {
@ -121,6 +122,9 @@ func (rr *retryResponseWriterWithoutCloseNotify) DisableRetries() {
}
func (rr *retryResponseWriterWithoutCloseNotify) Header() http.Header {
if rr.written {
return rr.responseWriter.Header()
}
return rr.headers
}
@ -155,6 +159,7 @@ func (rr *retryResponseWriterWithoutCloseNotify) WriteHeader(code int) {
}
rr.responseWriter.WriteHeader(code)
rr.written = true
}
func (rr *retryResponseWriterWithoutCloseNotify) Hijack() (net.Conn, *bufio.ReadWriter, error) {