Permalink
Browse files

Update intercept.js

  • Loading branch information...
1 parent 4fe1226 commit 0b955205a0504763f597b3afe7ceded8450ce353 @facundoolano facundoolano committed Sep 8, 2013
Showing with 6 additions and 4 deletions.
  1. +6 −4 lib/intercept.js
View
@@ -121,8 +121,10 @@ function removeAll() {
function normalizeForRequest(options) {
options.proto = options.proto || 'http';
options.port = options.port || ((options.proto === 'http') ? 80 : 443);
- options.hostname = options.hostname || options.host.split(':')[0];
- options.host = options.hostname + ':' + options.port;
+ if (options.host) {
+ options.hostname = options.hostname || options.host.split(':')[0];
+ }
+ options.host = (options.hostname || 'localhost') + ':' + options.port;
return options;
}
@@ -138,7 +140,7 @@ function interceptorsFor(options) {
}
-function activate() {
+function activate() n{
// ----- Extending http.ClientRequest
function OverridenClientRequest(options, cb) {
@@ -219,4 +221,4 @@ module.exports.removeAll = removeAll;
module.exports.isOn = isOn;
module.exports.activate = activate;
module.exports.enableNetConnect = enableNetConnect;
-module.exports.disableNetConnect = disableNetConnect;
+module.exports.disableNetConnect = disableNetConnect;

0 comments on commit 0b95520

Please sign in to comment.