code: function request(method, address, body, options) {
    let timeout = null;
    return new Promise((resolve, reject) => {
      try {
        const opts = _.merge({}, this.options, options, url.parse(address), {
          method,
        });
  
        // handle optional timeout
        if (typeof opts.timeout === 'number') {
          setTimeout(() => {
            reject(new Error(`${method} "${address}" timed out`));
            timeout = null;
          }, Math.floor(opts.timeout));
        }
  
        // create some request middleware to potentially
        // add headers ahead of time for auth or set cors, etc.
        const before =
          typeof opts.before === 'function'
            ? opts.before.call(this.context, method, address, opts)
            : () => null;
  
        const proto = opts.protocol === 'https:' ? https : http;
  
        return Promise.resolve(before)
          .then(() => {
            clearTimeout(timeout);
  
            const req = proto.request(opts, res => {
              let data = '';
              res
                .on('data', d => {
                  data += d;
                })
                .on('error', error => {
                  clearTimeout(timeout);
                  reject(error);
                })
                .on('end', () => {
                  clearTimeout(timeout);
                  const parsedData = processData(res, data, opts);
                  return parsedData instanceof Error
                    ? reject(parsedData)
                    : resolve(parsedData);
                });
            });
  
            req.on('error', error => {
              clearTimeout(timeout);
              reject(error);
            });
  
            if (method === Method.PUT || method === Method.POST) {
              req.write(processBody(opts, body));
            }
            req.end();
          })
          .catch(error => {
            clearTimeout(timeout);
            return reject(error);
          });
      } catch (error) {
        clearTimeout(timeout);
        return reject(error);
      }
    });
  }
docs: Main request method to perform an http(s) request
  @param {*} method
  @param {*} address
  @param {*} body
  @param {*} options