mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[rackspace][storage] allow for passing options to specify headers on put
This commit is contained in:
parent
91f875785d
commit
ddabb17ee9
2 changed files with 6 additions and 5 deletions
|
@ -41,9 +41,9 @@ module Fog
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def save
|
def save(options = {})
|
||||||
requires :body, :directory, :key
|
requires :body, :directory, :key
|
||||||
data = connection.put_object(directory.name, @key, @body)
|
data = connection.put_object(directory.name, @key, @body, options)
|
||||||
@etag = data.headers['ETag']
|
@etag = data.headers['ETag']
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,12 +8,13 @@ module Fog
|
||||||
# ==== Parameters
|
# ==== Parameters
|
||||||
# * container<~String> - Name for container, should be < 256 bytes and must not contain '/'
|
# * container<~String> - Name for container, should be < 256 bytes and must not contain '/'
|
||||||
#
|
#
|
||||||
def put_object(container, object, data)
|
def put_object(container, object, data, options = {})
|
||||||
data = parse_data(data)
|
data = parse_data(data)
|
||||||
|
headers = data[:headers].merge!(options)
|
||||||
response = storage_request(
|
response = storage_request(
|
||||||
:body => data[:body],
|
:body => data[:body],
|
||||||
:expects => 201,
|
:expects => 201,
|
||||||
:headers => data[:headers],
|
:headers => headers,
|
||||||
:method => 'PUT',
|
:method => 'PUT',
|
||||||
:path => "#{CGI.escape(container)}/#{CGI.escape(object)}"
|
:path => "#{CGI.escape(container)}/#{CGI.escape(object)}"
|
||||||
)
|
)
|
||||||
|
@ -24,7 +25,7 @@ module Fog
|
||||||
|
|
||||||
class Mock
|
class Mock
|
||||||
|
|
||||||
def put_object(container, object, data)
|
def put_object(container, object, data, options = {})
|
||||||
Fog::Mock.not_implemented
|
Fog::Mock.not_implemented
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue