Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit eea199b

Browse filesBrowse files
addaleaxtargos
authored andcommitted
test: fix http2 connection abort test
Refs: #21836 Refs: #21561 PR-URL: #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>
1 parent e8d5787 commit eea199b
Copy full SHA for eea199b

File tree

Expand file treeCollapse file tree

1 file changed

+3
-8
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-8
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-http2-respond-with-file-connection-abort.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http2-respond-with-file-connection-abort.js
+3-8Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
const common = require('../common');
44
if (!common.hasCrypto)
55
common.skip('missing crypto');
6+
const assert = require('assert');
67
const http2 = require('http2');
78
const net = require('net');
89

@@ -12,6 +13,7 @@ const {
1213

1314
const server = http2.createServer();
1415
server.on('stream', common.mustCall((stream) => {
16+
stream.on('error', (err) => assert.strictEqual(err.code, 'ECONNRESET'));
1517
stream.respondWithFile(process.execPath, {
1618
[HTTP2_HEADER_CONTENT_TYPE]: 'application/octet-stream'
1719
});
@@ -22,16 +24,9 @@ server.listen(0, common.mustCall(() => {
2224
const req = client.request();
2325

2426
req.on('response', common.mustCall(() => {}));
25-
req.on('data', common.mustCall(() => {
27+
req.on('data', common.mustCallAtLeast(() => {
2628
net.Socket.prototype.destroy.call(client.socket);
2729
server.close();
2830
}));
2931
req.end();
3032
}));
31-
32-
// TODO(addaleax): This is a *hack*. HTTP/2 needs to have a proper way of
33-
// dealing with this kind of issue.
34-
process.once('uncaughtException', (err) => {
35-
if (err.code === 'ECONNRESET') return;
36-
throw err;
37-
});

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.