mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Fog::Storage::OpenStack::Real#put_object: Don't use data when block is provided
Making request with 'Content-Length: 0' fails with status 499
This commit is contained in:
parent
bf4c376256
commit
f7427db942
2 changed files with 12 additions and 4 deletions
|
@ -12,10 +12,14 @@ module Fog
|
|||
# * options<~Hash> - config headers for object. Defaults to {}.
|
||||
#
|
||||
def put_object(container, object, data, options = {}, &block)
|
||||
data = Fog::Storage.parse_data(data)
|
||||
headers = data[:headers].merge!(options)
|
||||
|
||||
params = block_given? ? { :request_block => block } : { :body => data[:body] }
|
||||
if block_given?
|
||||
params = { :request_block => block }
|
||||
headers = options
|
||||
else
|
||||
data = Fog::Storage.parse_data(data)
|
||||
headers = data[:headers].merge!(options)
|
||||
params = { :body => data[:body] }
|
||||
end
|
||||
|
||||
params.merge!(
|
||||
:expects => 201,
|
||||
|
|
|
@ -44,6 +44,8 @@ Shindo.tests('Fog::Storage[:openstack] | object requests', ["openstack"]) do
|
|||
tests("put_object with block") do
|
||||
pending if Fog.mocking?
|
||||
|
||||
WebMock.disable! # https://github.com/bblimke/webmock/issues/307
|
||||
|
||||
tests("#put_object('fogobjecttests', 'fog_object', &block)").succeeds do
|
||||
begin
|
||||
file = lorem_file
|
||||
|
@ -56,6 +58,8 @@ Shindo.tests('Fog::Storage[:openstack] | object requests', ["openstack"]) do
|
|||
end
|
||||
end
|
||||
|
||||
WebMock.enable!
|
||||
|
||||
tests('#get_object').succeeds do
|
||||
Fog::Storage[:openstack].get_object('fogobjecttests', 'fog_block_object').body == lorem_file.read
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue