diff options
author | James M Snell <jasnell@gmail.com> | 2018-03-19 09:17:23 -0700 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2018-03-22 13:48:47 -0700 |
commit | cef909797af1d716b802f04264e51cf7f26c1b51 (patch) | |
tree | 0aec47d99dc8faf488f8f0e673b6f2113216887b /test/parallel | |
parent | ab755484a8a5113cb6d74f8e8ae5a26c44ae4582 (diff) | |
download | android-node-v8-cef909797af1d716b802f04264e51cf7f26c1b51.tar.gz android-node-v8-cef909797af1d716b802f04264e51cf7f26c1b51.tar.bz2 android-node-v8-cef909797af1d716b802f04264e51cf7f26c1b51.zip |
http2: do not emit our own close emit in Http2Stream
Streams were recently updated to emit their own close event. The
Http2Stream was an exception because it included the close argument
with the close event. Refactor that to use the built in close.
PR-URL: https://github.com/nodejs/node/pull/19451
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'test/parallel')
7 files changed, 14 insertions, 14 deletions
diff --git a/test/parallel/test-http2-client-rststream-before-connect.js b/test/parallel/test-http2-client-rststream-before-connect.js index 547ad2fa43..3120a80b11 100644 --- a/test/parallel/test-http2-client-rststream-before-connect.js +++ b/test/parallel/test-http2-client-rststream-before-connect.js @@ -49,9 +49,9 @@ server.listen(0, common.mustCall(() => { // Second call doesn't do anything. req.close(closeCode + 1); - req.on('close', common.mustCall((code) => { + req.on('close', common.mustCall(() => { assert.strictEqual(req.destroyed, true); - assert.strictEqual(code, closeCode); + assert.strictEqual(req.rstCode, closeCode); server.close(); client.close(); })); diff --git a/test/parallel/test-http2-client-stream-destroy-before-connect.js b/test/parallel/test-http2-client-stream-destroy-before-connect.js index 884a38fac6..d834de5d11 100644 --- a/test/parallel/test-http2-client-stream-destroy-before-connect.js +++ b/test/parallel/test-http2-client-stream-destroy-before-connect.js @@ -36,9 +36,9 @@ server.listen(0, common.mustCall(() => { message: 'test' })); - req.on('close', common.mustCall((code) => { + req.on('close', common.mustCall(() => { + assert.strictEqual(req.rstCode, NGHTTP2_INTERNAL_ERROR); assert.strictEqual(req.rstCode, NGHTTP2_INTERNAL_ERROR); - assert.strictEqual(code, NGHTTP2_INTERNAL_ERROR); server.close(); client.close(); })); diff --git a/test/parallel/test-http2-options-max-reserved-streams.js b/test/parallel/test-http2-options-max-reserved-streams.js index 994a881745..6dbf54bf31 100644 --- a/test/parallel/test-http2-options-max-reserved-streams.js +++ b/test/parallel/test-http2-options-max-reserved-streams.js @@ -37,8 +37,8 @@ server.on('stream', common.mustCall((stream) => { pushedStream.respond(); pushedStream.on('aborted', common.mustCall()); pushedStream.on('error', common.mustNotCall()); - pushedStream.on('close', common.mustCall((code) => { - assert.strictEqual(code, 8); + pushedStream.on('close', common.mustCall(() => { + assert.strictEqual(pushedStream.rstCode, 8); countdown.dec(); })); })); diff --git a/test/parallel/test-http2-server-rst-before-respond.js b/test/parallel/test-http2-server-rst-before-respond.js index c2831d3307..e7218aaeea 100644 --- a/test/parallel/test-http2-server-rst-before-respond.js +++ b/test/parallel/test-http2-server-rst-before-respond.js @@ -28,8 +28,8 @@ server.on('listening', common.mustCall(() => { const client = h2.connect(`http://localhost:${server.address().port}`); const req = client.request(); req.on('headers', common.mustNotCall()); - req.on('close', common.mustCall((code) => { - assert.strictEqual(h2.constants.NGHTTP2_NO_ERROR, code); + req.on('close', common.mustCall(() => { + assert.strictEqual(h2.constants.NGHTTP2_NO_ERROR, req.rstCode); server.close(); client.close(); })); diff --git a/test/parallel/test-http2-server-rst-stream.js b/test/parallel/test-http2-server-rst-stream.js index 402ff07fa9..132c32ead6 100644 --- a/test/parallel/test-http2-server-rst-stream.js +++ b/test/parallel/test-http2-server-rst-stream.js @@ -50,8 +50,8 @@ server.listen(0, common.mustCall(() => { ':method': 'POST', 'rstcode': test[0] }); - req.on('close', common.mustCall((code) => { - assert.strictEqual(code, test[0]); + req.on('close', common.mustCall(() => { + assert.strictEqual(req.rstCode, test[0]); countdown.dec(); })); req.on('aborted', common.mustCall()); diff --git a/test/parallel/test-http2-too-large-headers.js b/test/parallel/test-http2-too-large-headers.js index ad7a24f39b..b62a41d05f 100644 --- a/test/parallel/test-http2-too-large-headers.js +++ b/test/parallel/test-http2-too-large-headers.js @@ -22,8 +22,8 @@ server.listen(0, common.mustCall(() => { type: Error, message: 'Stream closed with error code NGHTTP2_ENHANCE_YOUR_CALM' })); - req.on('close', common.mustCall((code) => { - assert.strictEqual(code, NGHTTP2_ENHANCE_YOUR_CALM); + req.on('close', common.mustCall(() => { + assert.strictEqual(req.rstCode, NGHTTP2_ENHANCE_YOUR_CALM); server.close(); client.close(); })); diff --git a/test/parallel/test-http2-too-many-headers.js b/test/parallel/test-http2-too-many-headers.js index 9b57060be6..6c8315c80e 100644 --- a/test/parallel/test-http2-too-many-headers.js +++ b/test/parallel/test-http2-too-many-headers.js @@ -25,8 +25,8 @@ server.listen(0, common.mustCall(() => { type: Error, message: 'Stream closed with error code NGHTTP2_ENHANCE_YOUR_CALM' })); - req.on('close', common.mustCall((code) => { - assert.strictEqual(code, NGHTTP2_ENHANCE_YOUR_CALM); + req.on('close', common.mustCall(() => { + assert.strictEqual(req.rstCode, NGHTTP2_ENHANCE_YOUR_CALM); server.close(); client.close(); })); |