Set ETag header for directory listings
This commit is contained in:
parent
c676c1a6a8
commit
bec9f7a6cc
@ -75,10 +75,12 @@ module RemoteStorage
|
||||
end
|
||||
|
||||
def get_directory_listing(user, directory)
|
||||
# TODO add ETag header
|
||||
# TODO check IF_NONE_MATCH header
|
||||
etag = redis.hget "rs_meta:#{user}:#{directory}/", "etag"
|
||||
|
||||
|
||||
server.headers["Content-Type"] = "application/json"
|
||||
server.headers["ETag"] = %Q("#{etag}")
|
||||
|
||||
listing = {
|
||||
"@context" => "http://remotestorage.io/spec/folder-description",
|
||||
|
@ -176,6 +176,13 @@ describe "App" do
|
||||
|
||||
describe "directory listings" do
|
||||
|
||||
it "has an ETag in the header" do
|
||||
get "/phil/food/"
|
||||
|
||||
last_response.status.must_equal 200
|
||||
last_response.headers["ETag"].must_equal "\"bla\""
|
||||
end
|
||||
|
||||
it "contains all items in the directory" do
|
||||
get "/phil/food/"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user