Skip to content

Commit

Permalink
[HttpClient] honours multiple set-cookie headers
Browse files Browse the repository at this point in the history
  • Loading branch information
techthumb committed Oct 16, 2012
1 parent 97678b7 commit aab248c
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions lib/httpi/adapter/httpclient.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,20 @@ def setup_ssl_auth(ssl)
end

def respond_with(response)
Response.new response.code, Hash[*response.header.all.flatten], response.content
header_hash = {}
response.header.all.each do |item|
if header_hash.has_key?(item[0])
if header_hash[item[0]].is_a? Array
header_hash[item[0]] << item[1]
else
header_hash[item[0]] = [header_hash[item[0]], item[1]]
end
else
header_hash[item[0]] = item[1]
end
end
Response.new response.code, header_hash, response.content
end

end
end
end

0 comments on commit aab248c

Please sign in to comment.