fix: [RESTFUL] Return error when writer body closed (#41183)

Related to #41181

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
congqixia 2025-04-10 14:34:28 +08:00 committed by GitHub
parent 0d45b24599
commit b593bfd9a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -25,6 +25,7 @@ import (
"sync"
"time"
"github.com/cockroachdb/errors"
"github.com/gin-gonic/gin"
mhttp "github.com/milvus-io/milvus/internal/http"
@ -81,7 +82,7 @@ func NewWriter(w gin.ResponseWriter, buf *bytes.Buffer) *Writer {
// Write will write data to response body
func (w *Writer) Write(data []byte) (int, error) {
if w.timeout || w.body == nil {
return 0, nil
return 0, errors.New("Response writer closed")
}
w.mu.Lock()