Skip to content

Commit 49981b9

Browse files
debadree25RafaelGSS
authored andcommitted
test: reduce flakiness of test-http-remove-header-stays-removed.js
Refs: nodejs/reliability#508 Refs: #46333 PR-URL: #46855 Reviewed-By: Matteo Collina <[email protected]>
1 parent 8f9b9c1 commit 49981b9

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

test/parallel/test-http-remove-header-stays-removed.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
// USE OR OTHER DEALINGS IN THE SOFTWARE.
2121

2222
'use strict';
23-
require('../common');
23+
const common = require('../common');
2424
const assert = require('assert');
2525

2626
const http = require('http');
@@ -56,6 +56,14 @@ server.listen(0, function() {
5656
res.setEncoding('ascii');
5757
res.on('data', function(chunk) {
5858
response += chunk;
59+
if (response === 'beep boop\n') {
60+
setTimeout(function() {
61+
// The socket should be closed immediately, with no keep-alive, because
62+
// no content-length or transfer-encoding are used:
63+
assert.strictEqual(res.socket.closed, true);
64+
server.close();
65+
}, common.platformTimeout(15));
66+
}
5967
});
6068
});
6169
});

0 commit comments

Comments
 (0)