Skip to content

Commit

Permalink
[rackspace][storage] allow for passing options to specify headers on put
Browse files Browse the repository at this point in the history
  • Loading branch information
geemus committed Oct 7, 2010
1 parent 91f8757 commit ddabb17
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/fog/rackspace/models/storage/file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ def owner=(new_owner)
end
end

def save
def save(options = {})
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']
true
end
Expand Down
7 changes: 4 additions & 3 deletions lib/fog/rackspace/requests/storage/put_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ class Real
# ==== Parameters
# * 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)
headers = data[:headers].merge!(options)
response = storage_request(
:body => data[:body],
:expects => 201,
:headers => data[:headers],
:headers => headers,
:method => 'PUT',
:path => "#{CGI.escape(container)}/#{CGI.escape(object)}"
)
Expand All @@ -24,7 +25,7 @@ def put_object(container, object, data)

class Mock

def put_object(container, object, data)
def put_object(container, object, data, options = {})
Fog::Mock.not_implemented
end

Expand Down

0 comments on commit ddabb17

Please sign in to comment.