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

View File

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