Skip to content

Commit a743830

Browse files
committed
Minor tweak
1 parent 892736c commit a743830

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

source/core/utils/get-body-size.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import {Buffer} from 'node:buffer';
21
import {promisify} from 'node:util';
32
import type {ClientRequestArgs} from 'node:http';
43
import is from '@sindresorhus/is';
@@ -14,7 +13,7 @@ export default async function getBodySize(body: unknown, headers: ClientRequestA
1413
}
1514

1615
if (is.string(body)) {
17-
return Buffer.byteLength(body);
16+
return new TextEncoder().encode(body).byteLength;
1817
}
1918

2019
if (is.buffer(body)) {

0 commit comments

Comments
 (0)