Skip to content

Commit

Permalink
test: reduce flakiness of test-http-remove-header-stays-removed.js
Browse files Browse the repository at this point in the history
Refs: nodejs/reliability#508
Refs: #46333
PR-URL: #46855
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
  • Loading branch information
debadree25 committed Mar 18, 2023
1 parent 0d575fe commit 9ce2f4f
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions test/parallel/test-http-remove-header-stays-removed.js
Expand Up @@ -20,7 +20,7 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';
require('../common');
const common = require('../common');
const assert = require('assert');

const http = require('http');
Expand Down Expand Up @@ -54,13 +54,14 @@ server.listen(0, function() {
res.setEncoding('ascii');
res.on('data', function(chunk) {
response += chunk;
if (response === 'beep boop\n') {
setTimeout(function() {
// The socket should be closed immediately, with no keep-alive, because
// no content-length or transfer-encoding are used:
assert.strictEqual(res.socket.closed, true);
server.close();
}, common.platformTimeout(15));
}
});

setTimeout(function() {
// The socket should be closed immediately, with no keep-alive, because
// no content-length or transfer-encoding are used:
assert.strictEqual(res.socket.closed, true);
server.close();
}, 10);
});
});

0 comments on commit 9ce2f4f

Please sign in to comment.