Instead of special casing this, data and https, you can use node's `require('url').parse`, parse the url, check the protocol property of the result object. It can be more readable and easy to write as well.