diff options
author | Luigi Pinca <luigipinca@gmail.com> | 2019-11-11 16:51:28 +0100 |
---|---|---|
committer | Luigi Pinca <luigipinca@gmail.com> | 2019-11-15 16:25:37 +0100 |
commit | a4a089a5687c99f42c37d4d80d73f79e4c8d8da8 (patch) | |
tree | e7fc2380130590fd203833408612b174b3983519 /test/parallel/test-http-dump-req-when-res-ends.js | |
parent | 04e45db1726e1d2c11ecbf8cbacc82c88672fc83 (diff) | |
download | android-node-v8-a4a089a5687c99f42c37d4d80d73f79e4c8d8da8.tar.gz android-node-v8-a4a089a5687c99f42c37d4d80d73f79e4c8d8da8.tar.bz2 android-node-v8-a4a089a5687c99f42c37d4d80d73f79e4c8d8da8.zip |
test: deflake test-http-dump-req-when-res-ends.js
On some platforms the `'end'` event might not be emitted because the
socket could be destroyed by the other peer while the client is still
sending the data triggering an error. Use the `'close'` event instead.
PR-URL: https://github.com/nodejs/node/pull/30360
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'test/parallel/test-http-dump-req-when-res-ends.js')
-rw-r--r-- | test/parallel/test-http-dump-req-when-res-ends.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/test/parallel/test-http-dump-req-when-res-ends.js b/test/parallel/test-http-dump-req-when-res-ends.js index 718797fae1..01dbbca1b3 100644 --- a/test/parallel/test-http-dump-req-when-res-ends.js +++ b/test/parallel/test-http-dump-req-when-res-ends.js @@ -48,8 +48,12 @@ server.listen(0, mustCall(function() { res.resume(); - // Wait for the response. - res.on('end', function() { + // On some platforms the `'end'` event might not be emitted because the + // socket could be destroyed by the other peer while data is still being + // sent. In this case the 'aborted'` event is emitted instead of `'end'`. + // `'close'` is used here because it is always emitted and does not + // invalidate the test. + res.on('close', function() { server.close(); }); })); |