Updating the handling of Set-Cookie in http responses #121

Closed
wants to merge 2 commits into
from
@@ -8,7 +8,7 @@ def add_cookies(value)
merge!(value)
when String
value.split('; ').each do |cookie|
- array = cookie.split('=')
+ array = cookie.split('=',2)
self[array[0].to_sym] = array[1]
end
else
View
@@ -226,7 +226,7 @@ def capture_cookies(response)
return unless response['Set-Cookie']
cookies_hash = HTTParty::CookieHash.new()
cookies_hash.add_cookies(options[:headers]['Cookie']) if options[:headers] && options[:headers]['Cookie']
- cookies_hash.add_cookies(response['Set-Cookie'])
+ response.get_fields('Set-Cookie').each { |cookie| cookies_hash.add_cookies(cookie) }
options[:headers] ||= {}
options[:headers]['Cookie'] = cookies_hash.to_cookie_string
end