summaryrefslogtreecommitdiff
path: root/test/parallel/test-http-status-reason-invalid-chars.js
diff options
context:
space:
mode:
authorGibson Fahnestock <gib@uk.ibm.com>2017-01-17 10:30:43 +0000
committerJames M Snell <jasnell@gmail.com>2017-01-22 19:11:42 -0800
commit067be658f966dafe3d16bdd7b5bbb7c5e58c7250 (patch)
tree0c434e44cbe25189e93c20163c814ac260f6e596 /test/parallel/test-http-status-reason-invalid-chars.js
parentdcab88d529da07a73174ffb5e93cd3652a4fe0dd (diff)
downloadandroid-node-v8-067be658f966dafe3d16bdd7b5bbb7c5e58c7250.tar.gz
android-node-v8-067be658f966dafe3d16bdd7b5bbb7c5e58c7250.tar.bz2
android-node-v8-067be658f966dafe3d16bdd7b5bbb7c5e58c7250.zip
test: don't connect to :: (use localhost instead)
If a test does http.listen(0) or net.listen(0), http.listen(0).address().address returns '::'. Some machines will resolve this to localhost, but not all. Every machine should have localhost defined in /etc/hosts (or equivalent), so it should always resolve. Fixes: https://github.com/nodejs/node/issues/7291 PR-URL: https://github.com/nodejs/node/pull/10854 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michal Zasso <targos@protonmail.com>
Diffstat (limited to 'test/parallel/test-http-status-reason-invalid-chars.js')
-rw-r--r--test/parallel/test-http-status-reason-invalid-chars.js4
1 files changed, 1 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 9950eeeee9..75ccb2c243 100644
--- a/test/parallel/test-http-status-reason-invalid-chars.js
+++ b/test/parallel/test-http-status-reason-invalid-chars.js
@@ -3,7 +3,6 @@
const common = require('../common');
const assert = require('assert');
const http = require('http');
-const net = require('net');
function explicit(req, res) {
assert.throws(() => {
@@ -34,8 +33,7 @@ const server = http.createServer((req, res) => {
implicit(req, res);
}
}).listen(0, common.mustCall(() => {
- const addr = server.address().address;
- const hostname = net.isIPv6(addr) ? `[${addr}1]` : addr;
+ const hostname = 'localhost';
const url = `http://${hostname}:${server.address().port}`;
let left = 2;
const check = common.mustCall((res) => {