Skip to content

Commit

Permalink
test: update test-http-status-reason-invalid-chars to use countdown
Browse files Browse the repository at this point in the history
PR-URL: #17342
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
  • Loading branch information
mithunsasidharan authored and gibfahn committed Dec 20, 2017
1 parent 42454a5 commit 8f997c0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/parallel/test-http-status-reason-invalid-chars.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const common = require('../common');
const assert = require('assert');
const http = require('http');
const Countdown = require('../common/countdown');

function explicit(req, res) {
assert.throws(() => {
Expand Down Expand Up @@ -34,13 +35,12 @@ const server = http.createServer((req, res) => {
}
}).listen(0, common.mustCall(() => {
const hostname = 'localhost';
const countdown = new Countdown(2, () => server.close());
const url = `http://${hostname}:${server.address().port}`;
let left = 2;
const check = common.mustCall((res) => {
left--;
assert.notStrictEqual(res.headers['content-type'], 'text/html');
assert.notStrictEqual(res.headers['content-type'], 'gotcha');
if (left === 0) server.close();
countdown.dec();
}, 2);
http.get(`${url}/explicit`, check).end();
http.get(`${url}/implicit`, check).end();
Expand Down

0 comments on commit 8f997c0

Please sign in to comment.