simplify streaming handling

This commit is contained in:
WeidiDeng
2026-04-21 10:07:13 +08:00
committed by Francis Lavoie
parent b9b12025c6
commit e7055d85a4
3 changed files with 33 additions and 128 deletions

View File

@@ -422,20 +422,13 @@ func (rw *responseWriter) Close() error {
var err error
if rw.w != nil {
err = rw.w.Close()
rw.releaseEncoder()
rw.w.Reset(nil)
rw.config.writerPools[rw.encodingName].Put(rw.w)
rw.w = nil
}
return err
}
func (rw *responseWriter) releaseEncoder() {
if rw.w == nil {
return
}
rw.w.Reset(nil)
rw.config.writerPools[rw.encodingName].Put(rw.w)
rw.w = nil
}
// Unwrap returns the underlying ResponseWriter.
func (rw *responseWriter) Unwrap() http.ResponseWriter {
return rw.ResponseWriter