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`.