class Faraday::Utils::Headers
def parse(header_string)
def parse(header_string) return unless header_string && !header_string.empty? headers = header_string.split("\r\n") # Find the last set of response headers. start_index = headers.rindex { |x| x.start_with?('HTTP/') } || 0 last_response = headers.slice(start_index, headers.size) last_response .tap { |a| a.shift if a.first.start_with?('HTTP/') } .map { |h| h.split(/:\s*/, 2) } # split key and value .reject { |p| p[0].nil? } # ignore blank lines .each { |key, value| add_parsed(key, value) } end