diff options
author | Anna Henningsen <anna@addaleax.net> | 2022-07-11 16:40:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-11 15:40:08 +0100 |
commit | febb5390aaa242794fff2adec6afffe0d053f3ef (patch) | |
tree | c5c0934a1c052552baa34d0283bccf567958d7f3 /test/parallel/test-http-server-request-timeouts-mixed.js | |
parent | 02eb10b87b2a33afdcb7b2135e6907a9102649c0 (diff) | |
download | node-new-febb5390aaa242794fff2adec6afffe0d053f3ef.tar.gz |
test: remove unnecessary .toString() calls in HTTP tests
Let’s not have bad examples in our test suite and instead use the
proper way of converting stream data to UTF-8
(i.e. `stream.setEncoding('utf8')`) in all places.
PR-URL: https://github.com/nodejs/node/pull/43731
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Diffstat (limited to 'test/parallel/test-http-server-request-timeouts-mixed.js')
-rw-r--r-- | test/parallel/test-http-server-request-timeouts-mixed.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/test/parallel/test-http-server-request-timeouts-mixed.js b/test/parallel/test-http-server-request-timeouts-mixed.js index 44c8d03e3c..41b7542c1b 100644 --- a/test/parallel/test-http-server-request-timeouts-mixed.js +++ b/test/parallel/test-http-server-request-timeouts-mixed.js @@ -43,8 +43,9 @@ function createClient(server) { completed: false }; + request.client.setEncoding('utf8'); request.client.on('data', common.mustCallAtLeast((chunk) => { - request.response += chunk.toString('utf-8'); + request.response += chunk; })); request.client.on('end', common.mustCall(() => { |