code: function(url) {
      var protocol;
      if (url.indexOf('http://') !== -1) {
        protocol = http;
      } else if (url.indexOf('https://') !== -1) {
        protocol = https;
      } else {
        throw new Error('unsupported protocol :' + url);
      }
  
      return protocol;
    }
docs: Choose a protocol for the url.
  
  @param {string} url some url.
  @return {Object} http or https.