Skip to content

Commit ad2162a

Browse files
committed
http: make sure to pass encoding to Buffer.byteLength
1 parent daee170 commit ad2162a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/_http_outgoing.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,7 @@ function write_(msg, chunk, encoding, callback, fromEnd) {
893893

894894
if (!msg._header) {
895895
if (fromEnd) {
896-
len ??= typeof chunk === 'string' ? Buffer.byteLength(chunk) : chunk.byteLength;
896+
len ??= typeof chunk === 'string' ? Buffer.byteLength(chunk, encoding) : chunk.byteLength;
897897
msg._contentLength = len;
898898
}
899899
msg._implicitHeader();

0 commit comments

Comments
 (0)