[rackspace] more universally handle json parsing stuff for rackspace

This commit is contained in:
geemus 2010-07-02 10:03:19 -05:00
parent 9c1f4be6e8
commit b679f0f559
2 changed files with 3 additions and 3 deletions

View File

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

View File

@ -9,11 +9,11 @@ module Fog
# * name<~String> - Name for container, should be < 256 bytes and must not contain '/'
#
def put_container(name)
response = storage_request({
response = storage_request(
:expects => [201, 202],
:method => 'PUT',
:path => CGI.escape(name)
}, false)
)
response
end