mirror of
https://github.com/nodejs/node.git
synced 2026-11-26 21:58:26 -05:00
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>
This commit is contained in:
1 parent
43215c6c3c
commit
8e73a06bbf
1 file changed
+3
-3
@@ -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();
|
||||
|
||||
Reference in new issue
Block a user