[rackspace] fixes for breakage in rackspace files

This commit is contained in:
geemus 2010-07-17 16:50:31 -05:00
parent 2d0ca6c2e6
commit f35b5983dc
2 changed files with 6 additions and 4 deletions

View File

@ -107,7 +107,7 @@ module Fog
:host => @cdn_host,
:path => "#{@cdn_path}/#{params[:path]}",
}))
unless response.body.empty?
if !response.body.empty? && parse_json && response.headers['Content-Type'] =~ %r{application/json}
response.body = JSON.parse(response.body)
end
response
@ -122,7 +122,7 @@ module Fog
:host => @storage_host,
:path => "#{@storage_path}/#{params[:path]}",
}), &block)
if !response.body.empty? && parse_json && response.headers['Content-Type'] == 'application/json'
if !response.body.empty? && parse_json && response.headers['Content-Type'] =~ %r{application/json}
response.body = JSON.parse(response.body)
end
response

View File

@ -25,8 +25,10 @@ describe 'Rackspace::Files.get_container' do
end
describe 'failure' do
it "should not raise an if the container does not exist" do
it "should raise a NotFound error if the container does not exist" do
lambda do
Rackspace[:files].get_container('container_name')
end.should raise_error(Excon::Errors::NotFound)
end
end