Skip to content

Commit

Permalink
http: make sure to pass encoding to Buffer.byteLength
Browse files Browse the repository at this point in the history
  • Loading branch information
ronag committed Feb 10, 2023
1 parent d4714f6 commit 27a2c65
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/_http_outgoing.js
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ function write_(msg, chunk, encoding, callback, fromEnd) {

if (!msg._header) {
if (fromEnd) {
len ??= typeof chunk === 'string' ? Buffer.byteLength(chunk) : chunk.byteLength;
len ??= typeof chunk === 'string' ? Buffer.byteLength(chunk, encoding) : chunk.byteLength;
msg._contentLength = len;
}
msg._implicitHeader();
Expand Down

0 comments on commit 27a2c65

Please sign in to comment.