Simplify header parsing

This commit is contained in:
cnnrmnn 2021-05-14 09:44:05 -04:00
parent 8ef2d2ecc4
commit a156621297

View File

@ -121,10 +121,8 @@ module Utils
def parse_headers(headers)
return {} unless headers
headers.split("\n").to_h do |h|
partitioned = h.partition(": ")
[partitioned.first, partitioned.last]
end
# Skip status code
headers.split("\r\n")[2..].to_h { |h| h.split(": ") }
end
def curl_download(*args, to: nil, try_partial: true, **options)