diff --git a/test/parallel/test-http-incoming-pipelined-socket-destroy.js b/test/parallel/test-http-incoming-pipelined-socket-destroy.js index b9603a5791690c..7c15339785137b 100644 --- a/test/parallel/test-http-incoming-pipelined-socket-destroy.js +++ b/test/parallel/test-http-incoming-pipelined-socket-destroy.js @@ -60,9 +60,10 @@ const server = http.createServer(common.mustCall(function(req, res) { // Make a bunch of requests pipelined on the same socket function generator(seeds) { + const port = server.address().port; return seeds.map(function(r) { - return 'GET /' + r + ' HTTP/1.1\r\n' + - `Host: localhost:${server.address().port}\r\n` + + return `GET /${r} HTTP/1.1\r\n` + + `Host: localhost:${port}\r\n` + '\r\n' + '\r\n'; }).join('');