class Faraday::Utils::Headers

def parse(header_string)

def parse(header_string)
  return unless header_string && !header_string.empty?
  header_string.split(/\r\n/).
    tap  { |a| a.shift if a.first.index('HTTP/') == 0 }. # drop the HTTP status line
    map  { |h| h.split(/:\s+/, 2) }.reject { |(k, v)| k.nil? }. # split key and value, ignore blank lines
    each { |key, value|
      # join multiple values with a comma
      if self[key] then self[key] << ', ' << value
      else self[key] = value
      end
    }
end