1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[core] excluded :headers hash from symbolize_credentials in order to properly pass headers onto Excon

This commit is contained in:
Kyle Rames 2013-08-08 14:33:38 -05:00
parent 4b13e6c434
commit 1054c9f467
2 changed files with 16 additions and 1 deletions

View file

@ -50,11 +50,16 @@ module Fog
@credentials = new_credentials
end
def self.symbolize_credential?(key)
![:headers].include?(key)
end
def self.symbolize_credentials(args)
if args.is_a? Hash
copy = Array.new
args.each do |key, value|
copy.push(key.to_sym, self.symbolize_credentials(value))
obj = symbolize_credential?(key) ? value : self.symbolize_credentials(value)
copy.push(key.to_sym, obj)
end
Hash[*copy]
else

View file

@ -13,6 +13,16 @@ Shindo.tests('Fog::Core::Connection', ['core']) do
end
end
tests('new("http://example.com", false, options")') do
options = {
:headers => {'User-Agent' => 'custom agent'}
}
@instance = Fog::Core::Connection.new("http://example.com", true, options)
tests('user agent').returns('custom agent') do
@instance.instance_variable_get(:@excon).data[:headers]['User-Agent']
end
end
tests('new("http://example.com", true)') do
Fog::Core::Connection.new("http://example.com", true)
end