Skip to content

Commit ab8b3e7

Browse files
neunhoefpluma
authored andcommitted
DO NOT USE BUFFER, use byteLength instead
1 parent e3dd61f commit ab8b3e7

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/connection.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,7 @@ extend(Connection.prototype, {
6767
} else {
6868
body = String(body);
6969
}
70-
if (typeof body === "string") {
71-
body = new Buffer(body, "utf-8");
72-
}
73-
headers['content-length'] = body.length;
70+
headers['content-length'] = Buffer.byteLength(body, "utf-8");
7471
}
7572

7673
this._request({

0 commit comments

Comments
 (0)