fix: confirm header-only response delivery

This commit is contained in:
MiMoCode
2026-07-10 19:40:03 +08:00
parent 32988b6367
commit 62675e400b
3 changed files with 86 additions and 0 deletions
+1
View File
@@ -221,6 +221,7 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
h.rp.ServeHTTP(cw, r)
finished := time.Now()
cw.ConfirmDelivery()
responseComplete := !isStreamResponse(cw.Header()) || cw.SSEComplete()
if cw.Complete() && responseComplete && !st.readFailed.Load() && r.Context().Err() == nil {
submitOnce.Do(func() { submit(finished) })