diff options
author | Anna Henningsen <anna@addaleax.net> | 2018-07-17 23:53:35 +0200 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2018-07-23 17:02:29 +0200 |
commit | daa15b54baf0815e555eecdd96c4205dea24a17f (patch) | |
tree | 23467f3b0ba3a89c0686137687c5cd09352efeb6 /test/parallel/test-http2-respond-with-file-connection-abort.js | |
parent | 3095eecc4748da4ce7ac70e2b352ddba6c4c4deb (diff) | |
download | android-node-v8-daa15b54baf0815e555eecdd96c4205dea24a17f.tar.gz android-node-v8-daa15b54baf0815e555eecdd96c4205dea24a17f.tar.bz2 android-node-v8-daa15b54baf0815e555eecdd96c4205dea24a17f.zip |
test: fix http2 connection abort test
Refs: https://github.com/nodejs/node/issues/21836
Refs: https://github.com/nodejs/node/pull/21561
PR-URL: https://github.com/nodejs/node/pull/21861
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Diffstat (limited to 'test/parallel/test-http2-respond-with-file-connection-abort.js')
-rw-r--r-- | test/parallel/test-http2-respond-with-file-connection-abort.js | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/test/parallel/test-http2-respond-with-file-connection-abort.js b/test/parallel/test-http2-respond-with-file-connection-abort.js index 25926b2c98..6c8337ba8b 100644 --- a/test/parallel/test-http2-respond-with-file-connection-abort.js +++ b/test/parallel/test-http2-respond-with-file-connection-abort.js @@ -3,6 +3,7 @@ const common = require('../common'); if (!common.hasCrypto) common.skip('missing crypto'); +const assert = require('assert'); const http2 = require('http2'); const net = require('net'); @@ -12,6 +13,7 @@ const { const server = http2.createServer(); server.on('stream', common.mustCall((stream) => { + stream.on('error', (err) => assert.strictEqual(err.code, 'ECONNRESET')); stream.respondWithFile(process.execPath, { [HTTP2_HEADER_CONTENT_TYPE]: 'application/octet-stream' }); @@ -22,16 +24,9 @@ server.listen(0, common.mustCall(() => { const req = client.request(); req.on('response', common.mustCall(() => {})); - req.on('data', common.mustCall(() => { + req.on('data', common.mustCallAtLeast(() => { net.Socket.prototype.destroy.call(client.socket); server.close(); })); req.end(); })); - -// TODO(addaleax): This is a *hack*. HTTP/2 needs to have a proper way of -// dealing with this kind of issue. -process.once('uncaughtException', (err) => { - if (err.code === 'ECONNRESET') return; - throw err; -}); |