Skip to content

Commit d0efa94

Browse files
committed
test: deflake test-http-many-ended-pipelines
Fixes: nodejs#37291
1 parent 3ef9562 commit d0efa94

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/parallel/test-http-many-ended-pipelines.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ console.trace = function() {
2929
throw new Error('no tracing should happen here');
3030
};
3131

32+
const assert = require('assert');
3233
const http = require('http');
3334
const net = require('net');
3435

@@ -51,6 +52,13 @@ const server = http.createServer(function(req, res) {
5152
server.listen(0, function() {
5253
const client = net.connect({ port: this.address().port,
5354
allowHalfOpen: true });
55+
56+
client.on('error', function(err) {
57+
// The socket might be destroyed by the other peer while data is still
58+
// being written.
59+
assert.strictEqual(err.code, 'ECONNRESET');
60+
});
61+
5462
for (let i = 0; i < numRequests; i++) {
5563
client.write('GET / HTTP/1.1\r\n' +
5664
'Host: some.host.name\r\n' +

0 commit comments

Comments
 (0)