diff --git a/lib/remote_storage/swift.rb b/lib/remote_storage/swift.rb index 247f36c..d2b1aa7 100644 --- a/lib/remote_storage/swift.rb +++ b/lib/remote_storage/swift.rb @@ -183,6 +183,7 @@ module RemoteStorage delete_metadata_objects(user, directory, key) delete_dir_objects(user, directory) + server.headers["Etag"] = %Q("#{existing_metadata["e"]}") server.halt 200 rescue RestClient::ResourceNotFound server.halt 404 diff --git a/spec/swift/app_spec.rb b/spec/swift/app_spec.rb index dd7c752..264fc59 100644 --- a/spec/swift/app_spec.rb +++ b/spec/swift/app_spec.rb @@ -239,6 +239,14 @@ describe "App" do redis.smembers("rs:m:phil:/:items").must_be_empty end + + it "responds with the ETag of the deleted item in the haeder" do + RestClient.stub :delete, "" do + delete "/phil/food/aguacate" + end + + last_response.headers["ETag"].must_equal "\"bla\"" + end end end