code: function parseHeaders() {
    var str = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0];
  
    var lines = str.split(/\r?\n/);
    var fields = {};
    var index = undefined;
    var line = undefined;
    var field = undefined;
    var val = undefined;
  
    lines.pop(); // trailing CRLF
  
    for (var i = 0, len = lines.length; i < len; i += 1) {
      line = lines[i];
      index = line.indexOf(':');
      field = line.slice(0, index).toLowerCase();
      val = trim(line.slice(index + 1));
      fields[field] = val;
    }
  
    return fields;
  }
docs: borrow from superagent