[bbg] fix header assignment

This commit is contained in:
geemus 2010-06-02 08:31:33 -07:00
parent b8ce545f66
commit 9f24c7921a
2 changed files with 12 additions and 10 deletions

View File

@ -62,14 +62,15 @@ module Fog
def request(params) def request(params)
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}") @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}")
headers = { params[:headers] ||= {}
'Authorization' => "Basic #{Base64.encode64(@bluebox_api_key).chop!}" params[:headers].merge!({
}.merge!(params[:headers] || {}) 'Authorization' => "Basic #{Base64.encode64(@bluebox_api_key).delete("\r\n")}"
})
case params[:method] case params[:method]
when 'DELETE', 'GET', 'HEAD' when 'DELETE', 'GET', 'HEAD'
headers['Accept'] = 'application/xml' params[:headers]['Accept'] = 'application/xml'
when 'POST', 'PUT' when 'POST', 'PUT'
headers['Content-Type'] = 'application/xml' params[:headers]['Content-Type'] = 'application/xml'
end end
@connection.request({:host => @host}.merge!(params)) @connection.request({:host => @host}.merge!(params))

View File

@ -72,14 +72,15 @@ module Fog
def request(params) def request(params)
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}") @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}")
headers = { params[:headers] ||= {}
'Authorization' => "Basic #{Base64.encode64(@slicehost_password).chop!}" params[:headers].merge!({
}.merge!(params[:headers] || {}) 'Authorization' => "Basic #{Base64.encode64(@slicehost_password).delete("\r\n")}"
})
case params[:method] case params[:method]
when 'DELETE', 'GET', 'HEAD' when 'DELETE', 'GET', 'HEAD'
headers['Accept'] = 'application/xml' params[:headers]['Accept'] = 'application/xml'
when 'POST', 'PUT' when 'POST', 'PUT'
headers['Content-Type'] = 'application/xml' params[:headers]['Content-Type'] = 'application/xml'
end end
begin begin