[bbg|slicehost] cleanup/consistency update request

This commit is contained in:
geemus 2010-06-01 21:45:07 -07:00
parent 869113a75f
commit f672badddc
2 changed files with 6 additions and 22 deletions

View File

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

View File

@ -73,8 +73,8 @@ module Fog
def request(params)
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}")
headers = {
'Authorization' => "Basic #{Base64.encode64(@slicehost_password).delete("\r\n")}"
}
'Authorization' => "Basic #{Base64.encode64(@slicehost_password).chop!}"
}.merge!(params[:headers] || {})
case params[:method]
when 'DELETE', 'GET', 'HEAD'
headers['Accept'] = 'application/xml'
@ -83,15 +83,7 @@ module Fog
end
begin
response = @connection.request({
:body => params[:body],
:expects => params[:expects],
:headers => headers.merge!(params[:headers] || {}),
:host => @host,
:method => params[:method],
:parser => params[:parser],
:path => params[:path]
})
response = @connection.request({:host => @host}.merge!(params))
rescue Excon::Errors::Error => error
case error
when Excon::Errors::NotFound