Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 91d5416

Browse filesBrowse files
mithunsasidharanMylesBorins
authored andcommitted
test: update test-http-status-reason-invalid-chars to use countdown
PR-URL: #17342 Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
1 parent d3e76e7 commit 91d5416
Copy full SHA for 91d5416

File tree

Expand file treeCollapse file tree

1 file changed

+3
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-3
lines changed
Open diff view settings
Collapse file

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

Copy file name to clipboardExpand all lines: test/parallel/test-http-status-reason-invalid-chars.js
+3-3Lines changed: 3 additions & 3 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.