test: remove common.PORT from http tests
PR-URL: https://github.com/nodejs/node/pull/7467 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
42de4bb819
commit
abce60cec0
@ -4,16 +4,18 @@ const http = require('http');
|
|||||||
|
|
||||||
const server = http.createServer((req, res) => {
|
const server = http.createServer((req, res) => {
|
||||||
res.end();
|
res.end();
|
||||||
}).listen(common.PORT, common.mustCall(() => {
|
}).listen(0, common.mustCall(() => {
|
||||||
const agent = new http.Agent({
|
const agent = new http.Agent({
|
||||||
maxSockets: 1,
|
maxSockets: 1,
|
||||||
keepAlive: true
|
keepAlive: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const port = server.address().port;
|
||||||
|
|
||||||
const post = http.request({
|
const post = http.request({
|
||||||
agent: agent,
|
agent,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
port: common.PORT,
|
port,
|
||||||
}, common.mustCall((res) => {
|
}, common.mustCall((res) => {
|
||||||
res.resume();
|
res.resume();
|
||||||
}));
|
}));
|
||||||
@ -28,9 +30,9 @@ const server = http.createServer((req, res) => {
|
|||||||
}, 100);
|
}, 100);
|
||||||
|
|
||||||
http.request({
|
http.request({
|
||||||
agent: agent,
|
agent,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
port: common.PORT,
|
port,
|
||||||
}, common.mustCall((res) => {
|
}, common.mustCall((res) => {
|
||||||
server.close();
|
server.close();
|
||||||
res.connection.end();
|
res.connection.end();
|
||||||
|
@ -15,16 +15,18 @@ const server = http.createServer((req, res) => {
|
|||||||
res.end();
|
res.end();
|
||||||
onPause();
|
onPause();
|
||||||
});
|
});
|
||||||
}).listen(common.PORT, common.mustCall(() => {
|
}).listen(0, common.mustCall(() => {
|
||||||
const agent = new http.Agent({
|
const agent = new http.Agent({
|
||||||
maxSockets: 1,
|
maxSockets: 1,
|
||||||
keepAlive: true
|
keepAlive: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const port = server.address().port;
|
||||||
|
|
||||||
const post = http.request({
|
const post = http.request({
|
||||||
agent: agent,
|
agent,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
port: common.PORT,
|
port,
|
||||||
}, common.mustCall((res) => {
|
}, common.mustCall((res) => {
|
||||||
res.resume();
|
res.resume();
|
||||||
|
|
||||||
@ -41,9 +43,9 @@ const server = http.createServer((req, res) => {
|
|||||||
post.write('initial');
|
post.write('initial');
|
||||||
|
|
||||||
http.request({
|
http.request({
|
||||||
agent: agent,
|
agent,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
port: common.PORT,
|
port,
|
||||||
}, common.mustCall((res) => {
|
}, common.mustCall((res) => {
|
||||||
server.close();
|
server.close();
|
||||||
res.connection.end();
|
res.connection.end();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user