diff options
author | Rich Trott <rtrott@gmail.com> | 2017-08-26 12:28:07 -0700 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2017-08-26 13:13:17 -0700 |
commit | f912080bf2d8fd024d3443f3ab9e399bc84a724b (patch) | |
tree | 3e7788b04811297547de8edb4ea2c88f7352b7f9 /test/parallel/test-http2-server-errors.js | |
parent | 99c478eb3629292e625a4d2fd634e89f0120ab91 (diff) | |
download | android-node-v8-f912080bf2d8fd024d3443f3ab9e399bc84a724b.tar.gz android-node-v8-f912080bf2d8fd024d3443f3ab9e399bc84a724b.tar.bz2 android-node-v8-f912080bf2d8fd024d3443f3ab9e399bc84a724b.zip |
Revert "http2: refactor error handling"
This reverts commit 4ca8ff264f368c301827e07956f313cebd1b8de8.
That commit was landed without a green CI and is failing on Windows.
PR-URL: https://github.com/nodejs/node/pull/15047
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-http2-server-errors.js')
-rw-r--r-- | test/parallel/test-http2-server-errors.js | 97 |
1 files changed, 0 insertions, 97 deletions
diff --git a/test/parallel/test-http2-server-errors.js b/test/parallel/test-http2-server-errors.js deleted file mode 100644 index 9280d63edb..0000000000 --- a/test/parallel/test-http2-server-errors.js +++ /dev/null @@ -1,97 +0,0 @@ -// Flags: --expose-http2 --expose-internals -'use strict'; - -const common = require('../common'); -if (!common.hasCrypto) - common.skip('missing crypto'); -const assert = require('assert'); -const h2 = require('http2'); -const { Http2Stream } = require('internal/http2/core'); - -// Errors should not be reported both in Http2ServerRequest -// and Http2ServerResponse - -{ - let expected = null; - - const server = h2.createServer(); - - server.on('stream', common.mustCall(function(stream) { - stream.on('error', common.mustCall(function(err) { - assert.strictEqual(err, expected); - })); - - stream.resume(); - stream.write('hello'); - - expected = new Error('kaboom'); - stream.destroy(expected); - server.close(); - })); - - server.on('streamError', common.mustCall(function(err, stream) { - assert.strictEqual(err, expected); - assert.strictEqual(stream instanceof Http2Stream, true); - })); - - server.listen(0, common.mustCall(function() { - const port = server.address().port; - - const url = `http://localhost:${port}`; - const client = h2.connect(url, common.mustCall(function() { - const headers = { - ':path': '/foobar', - ':method': 'GET', - ':scheme': 'http', - ':authority': `localhost:${port}`, - }; - const request = client.request(headers); - request.on('data', common.mustCall(function(chunk) { - // cause an error on the server side - client.destroy(); - })); - request.end(); - })); - })); -} - -{ - let expected = null; - - const server = h2.createServer(); - - server.on('stream', common.mustCall(function(stream) { - // there is no 'error' handler, and this will not crash - stream.write('hello'); - stream.resume(); - - expected = new Error('kaboom'); - stream.destroy(expected); - server.close(); - })); - - server.on('streamError', common.mustCall(function(err, stream) { - assert.strictEqual(err, expected); - assert.strictEqual(stream instanceof Http2Stream, true); - })); - - server.listen(0, common.mustCall(function() { - const port = server.address().port; - - const url = `http://localhost:${port}`; - const client = h2.connect(url, common.mustCall(function() { - const headers = { - ':path': '/foobar', - ':method': 'GET', - ':scheme': 'http', - ':authority': `localhost:${port}`, - }; - const request = client.request(headers); - request.on('data', common.mustCall(function(chunk) { - // cause an error on the server side - client.destroy(); - })); - request.end(); - })); - })); -} |