Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
removed changes on test-http-localaddress.js
  • Loading branch information
tpanthera committed Nov 20, 2018
commit 520b2aa0a6b8865f1be90dd181c81ec57db8dc30
8 changes: 4 additions & 4 deletions test/parallel/test-http-localaddress.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,26 @@ if (!common.hasMultiLocalhost())
const http = require('http');
const assert = require('assert');

const server = http.createServer((req, res) => {
const server = http.createServer(function(req, res) {
console.log(`Connect from: ${req.connection.remoteAddress}`);
assert.strictEqual(req.connection.remoteAddress, '127.0.0.2');

req.on('end', () => {
req.on('end', function() {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end(`You are from: ${req.connection.remoteAddress}`);
});
req.resume();
});

server.listen(0, '127.0.0.1', () => {
server.listen(0, '127.0.0.1', function() {
const options = { host: 'localhost',
port: this.address().port,
path: '/',
method: 'GET',
localAddress: '127.0.0.2' };

const req = http.request(options, function(res) {
res.on('end', () => {
res.on('end', function() {
server.close();
process.exit();
});
Expand Down