summaryrefslogtreecommitdiff
path: root/test/parallel/test-http-server-request-timeouts-mixed.js
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2022-07-11 16:40:08 +0200
committerGitHub <noreply@github.com>2022-07-11 15:40:08 +0100
commitfebb5390aaa242794fff2adec6afffe0d053f3ef (patch)
treec5c0934a1c052552baa34d0283bccf567958d7f3 /test/parallel/test-http-server-request-timeouts-mixed.js
parent02eb10b87b2a33afdcb7b2135e6907a9102649c0 (diff)
downloadnode-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.js3
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(() => {