fix missing trailers with retry
This commit is contained in:
parent
06905cb14a
commit
db13dbdf46
4 changed files with 86 additions and 0 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue