Last active
August 29, 2015 14:06
-
-
Save misterdjules/9ff53baa61efbb5f9256 to your computer and use it in GitHub Desktop.
Using server.address().address in test/req.ip.js test for express
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/test/req.ip.js b/test/req.ip.js | |
index f24401c..a17b924 100644 | |
--- a/test/req.ip.js | |
+++ b/test/req.ip.js | |
@@ -60,11 +60,14 @@ describe('req', function(){ | |
res.send(req.ip); | |
}); | |
- request(app) | |
- .get('/') | |
- .set('X-Forwarded-For', 'client, p1, p2') | |
- .expect(isLoopbackIp) | |
- .end(done); | |
+ var server = app.listen(function() { | |
+ request(app) | |
+ .get('/') | |
+ .set('X-Forwarded-For', 'client, p1, p2') | |
+ .expect(server.address().address) | |
+ .end(done); | |
+ }); | |
+ | |
}) | |
}) | |
}) | |
@@ -79,10 +82,13 @@ describe('req', function(){ | |
res.send(req.ip); | |
}); | |
- request(app) | |
- .get('/') | |
- .expect(isLoopbackIp) | |
- .end(done); | |
+ var server = app.listen(function() { | |
+ request(app) | |
+ .get('/') | |
+ .expect(server.address().address) | |
+ .end(done); | |
+ }); | |
+ | |
}) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment