mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[bbg] fix header assignment
This commit is contained in:
parent
b8ce545f66
commit
9f24c7921a
2 changed files with 12 additions and 10 deletions
|
@ -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))
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue