Duplicate SSL settings on #dup call

This commit is contained in:
Saulius Grigaliunas 2011-07-28 11:49:46 +03:00
parent 194f06be24
commit 29bfde444b
2 changed files with 4 additions and 3 deletions

View File

@ -237,7 +237,7 @@ module Faraday
end
def dup
self.class.new(build_url(''), :headers => headers.dup, :params => params.dup, :builder => builder.dup)
self.class.new(build_url(''), :headers => headers.dup, :params => params.dup, :builder => builder.dup, :ssl => ssl.dup)
end
def proxy_arg_to_uri(arg)

View File

@ -238,15 +238,16 @@ class TestConnection < Faraday::TestCase
end
def test_dups_connection_object
conn = Faraday::Connection.new 'http://sushi.com/foo' do |b|
conn = Faraday::Connection.new 'http://sushi.com/foo', :ssl => { :verify => :none } do |b|
b.adapter :net_http
end
conn.headers['content-type'] = 'text/plain'
conn.params['a'] = '1'
duped = conn.dup
assert_equal conn.build_url(''), duped.build_url('')
[:headers, :params, :builder].each do |attr|
[:headers, :params, :builder, :ssl].each do |attr|
assert_equal conn.send(attr), duped.send(attr)
assert_not_equal conn.send(attr).object_id, duped.send(attr).object_id
end