diff options
author | Mithun Sasidharan <mithunsasidharan89@gmail.com> | 2017-11-27 11:43:20 +0530 |
---|---|---|
committer | Jon Moss <me@jonathanmoss.me> | 2017-12-03 14:23:48 -0500 |
commit | 2afd4e779c8e562dea83a58b46a2b348c07df59b (patch) | |
tree | 637d4bb5cb558554a0cd82b3ada1911338cf19e1 /test/parallel/test-http-status-reason-invalid-chars.js | |
parent | fff4272fa7ce5044a800195be7c40664f9aa04ec (diff) | |
download | android-node-v8-2afd4e779c8e562dea83a58b46a2b348c07df59b.tar.gz android-node-v8-2afd4e779c8e562dea83a58b46a2b348c07df59b.tar.bz2 android-node-v8-2afd4e779c8e562dea83a58b46a2b348c07df59b.zip |
test: update test-http-status-reason-invalid-chars to use countdown
PR-URL: https://github.com/nodejs/node/pull/17342
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Diffstat (limited to 'test/parallel/test-http-status-reason-invalid-chars.js')
-rw-r--r-- | test/parallel/test-http-status-reason-invalid-chars.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/test/parallel/test-http-status-reason-invalid-chars.js b/test/parallel/test-http-status-reason-invalid-chars.js index 75ccb2c243..ce08ff84a0 100644 --- a/test/parallel/test-http-status-reason-invalid-chars.js +++ b/test/parallel/test-http-status-reason-invalid-chars.js @@ -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(() => { @@ -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(); |