proxy: fix zero duration for non streaming responses (#723)

Updates #654
This commit is contained in:
Benson Wong
2026-04-30 19:51:28 -07:00
committed by GitHub
parent 5b4beaceef
commit 430166d5eb
2 changed files with 2 additions and 10 deletions
+1 -5
View File
@@ -578,15 +578,11 @@ func newBodyCopier(w gin.ResponseWriter) *responseBodyCopier {
ResponseWriter: w,
body: bodyBuffer,
tee: io.MultiWriter(w, bodyBuffer),
start: time.Now(),
}
}
func (w *responseBodyCopier) Write(b []byte) (int, error) {
if w.start.IsZero() {
w.start = time.Now()
}
// Single write operation that writes to both the response and buffer
return w.tee.Write(b)
}