From 16e51038b10aa8d2ed7c2cf3fd2bb9aaece7c882 Mon Sep 17 00:00:00 2001 From: Garret Alfert Date: Thu, 2 Jun 2016 16:43:50 +0200 Subject: [PATCH] Send ETag of deleted item in header --- lib/remote_storage/swift.rb | 1 + spec/swift/app_spec.rb | 8 ++++++++ 2 files changed, 9 insertions(+) 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