Skip to content

Commit 21e15c1

Browse files
committed
fixup
1 parent 20dc54d commit 21e15c1

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/_http_outgoing.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -966,13 +966,12 @@ function write_(msg, chunk, encoding, callback, fromEnd) {
966966

967967
let ret;
968968
if (msg.chunkedEncoding && chunk.length !== 0) {
969+
len ??= typeof chunk === 'string' ? Buffer.byteLength(chunk, encoding) : chunk.byteLength;
969970
if (msg[kCorked] && msg._headerSent) {
970-
len ??= typeof chunk === 'string' ? Buffer.byteLength(chunk, encoding) : chunk.byteLength;
971971
msg[kChunkedBuffer].push(chunk, encoding, callback);
972972
msg[kChunkedLength] += len;
973973
ret = msg[kChunkedLength] < msg[kHighWaterMark];
974974
} else {
975-
len ??= typeof chunk === 'string' ? Buffer.byteLength(chunk, encoding) : chunk.byteLength;
976975
msg._send(NumberPrototypeToString(len, 16), 'latin1', null);
977976
msg._send(crlf_buf, null, null);
978977
msg._send(chunk, encoding, null, len);

0 commit comments

Comments
 (0)