Skip to content

Commit 91d5416

Browse files
mithunsasidharanMylesBorins
authored andcommitted
test: update test-http-status-reason-invalid-chars to use countdown
PR-URL: #17342 Reviewed-By: Jon Moss <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]>
1 parent d3e76e7 commit 91d5416

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

test/parallel/test-http-status-reason-invalid-chars.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
const common = require('../common');
44
const assert = require('assert');
55
const http = require('http');
6+
const Countdown = require('../common/countdown');
67

78
function explicit(req, res) {
89
assert.throws(() => {
@@ -34,13 +35,12 @@ const server = http.createServer((req, res) => {
3435
}
3536
}).listen(0, common.mustCall(() => {
3637
const hostname = 'localhost';
38+
const countdown = new Countdown(2, () => server.close());
3739
const url = `http://${hostname}:${server.address().port}`;
38-
let left = 2;
3940
const check = common.mustCall((res) => {
40-
left--;
4141
assert.notStrictEqual(res.headers['content-type'], 'text/html');
4242
assert.notStrictEqual(res.headers['content-type'], 'gotcha');
43-
if (left === 0) server.close();
43+
countdown.dec();
4444
}, 2);
4545
http.get(`${url}/explicit`, check).end();
4646
http.get(`${url}/implicit`, check).end();

0 commit comments

Comments
 (0)