fix: confirm header-only response delivery
This commit is contained in:
@@ -75,6 +75,19 @@ func (c *captureWriter) Flush() {
|
||||
c.flush()
|
||||
}
|
||||
|
||||
// ConfirmDelivery establishes an observable delivery boundary for responses
|
||||
// whose headers were not followed by a body write.
|
||||
func (c *captureWriter) ConfirmDelivery() {
|
||||
if c.written != 0 {
|
||||
return
|
||||
}
|
||||
if _, ok := c.ResponseWriter.(http.Flusher); !ok {
|
||||
c.writeFailed = true
|
||||
return
|
||||
}
|
||||
c.flush()
|
||||
}
|
||||
|
||||
func (c *captureWriter) flush() {
|
||||
if _, ok := c.ResponseWriter.(http.Flusher); !ok {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user