node: fix error condition in gzipResponseWriter.init() (#32896)

This commit is contained in:
Luke Ma 2025-10-13 15:26:35 +08:00 committed by Alvarez
parent 6f1d236405
commit 729484bda7

View file

@ -500,7 +500,7 @@ func (w *gzipResponseWriter) init() {
hdr := w.resp.Header()
length := hdr.Get("content-length")
if len(length) > 0 {
if n, err := strconv.ParseUint(length, 10, 64); err != nil {
if n, err := strconv.ParseUint(length, 10, 64); err == nil {
w.hasLength = true
w.contentLength = n
}