1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[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, :host => @storage_host,
:path => "#{@storage_path}/#{params[:path]}", :path => "#{@storage_path}/#{params[:path]}",
}), &block) }), &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) response.body = JSON.parse(response.body)
end end
response response

View file

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