From 0ffbeb4148f05a52313e0d607f0e7ece8dbd7aa7 Mon Sep 17 00:00:00 2001
From: Derek <derekr@me.com>
Date: Tue, 24 Sep 2013 22:20:19 -0700
Subject: [PATCH] Check for undefined port when assigning default

`lib/request` builds the uri based on a falsey port (it won't append a
port number if there isn't one), but this case makes it difficult to
test cross domain requests when running on a non standard port number
since it's always defaulting to `window.location.port`.
---
 index.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/index.js b/index.js
index 8dc17f6..10a1ba8 100644
--- a/index.js
+++ b/index.js
@@ -5,7 +5,7 @@ var Request = require('./lib/request');
 http.request = function (params, cb) {
     if (!params) params = {};
     if (!params.host) params.host = window.location.host.split(':')[0];
-    if (!params.port) params.port = window.location.port;
+    if (typeof params.port === 'undefined') params.port = window.location.port;
     if (!params.scheme) params.scheme = window.location.protocol.split(':')[0];
     
     var req = new Request(new xhrHttp, params);