Support informational headers in middlewares redefining the response writer.
Co-authored-by: LandryBe <lbenguigui@gmail.com>
This commit is contained in:
parent
68ed875966
commit
6885e410f0
10 changed files with 471 additions and 7 deletions
|
@ -209,7 +209,7 @@ func (r *responseWriterWithoutCloseNotify) WriteHeader(code int) {
|
|||
r.DisableRetries()
|
||||
}
|
||||
|
||||
if r.ShouldRetry() {
|
||||
if r.ShouldRetry() || r.written {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -223,6 +223,13 @@ func (r *responseWriterWithoutCloseNotify) WriteHeader(code int) {
|
|||
}
|
||||
|
||||
r.responseWriter.WriteHeader(code)
|
||||
|
||||
// Handling informational headers.
|
||||
// This allows to keep writing to r.headers map until a final status code is written.
|
||||
if code >= 100 && code <= 199 {
|
||||
return
|
||||
}
|
||||
|
||||
r.written = true
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue