Fixes #583, moved initialization of self.uri.pathname 

Moved the initialization of `self.uri.pathname` up and removed the check for `self.uri.pathname` being falsey.

Also changed the `isUrl` regex to handle mixed case properly (e.g. ignore it) and added some test cases for that.