Requests for empty directories respond with 404 (refs #26)

This commit is contained in:
Garret Alfert 2013-08-08 17:13:05 +02:00
parent 2656239fb1
commit f852e7719f
3 changed files with 7 additions and 9 deletions

View File

@ -75,8 +75,7 @@ module RemoteStorage
return listing.to_json
rescue ::Riak::HTTPFailedRequest
server.headers["Content-Type"] = "application/json"
return "{}"
server.halt 404
end
def put_data(user, directory, key, data, content_type=nil)

View File

@ -187,8 +187,7 @@ describe "Directories" do
it "returns an empty listing" do
get "/jimmy/documents/notfound/"
last_response.status.must_equal 200
last_response.body.must_equal "{}"
last_response.status.must_equal 404
end
end

View File

@ -345,7 +345,7 @@ describe "Permissions" do
it "allows GET requests" do
get "/jimmy/public/tasks/"
last_response.status.must_equal 200
last_response.status.must_equal 404
end
it "allows PUT requests" do
@ -403,19 +403,19 @@ describe "Permissions" do
end
it "allows GET requests" do
get "/jimmy/tasks/"
get "/jimmy/public/tasks/"
last_response.status.must_equal 200
last_response.status.must_equal 404
end
it "disallows PUT requests" do
put "/jimmy/tasks/foo", "some text"
put "/jimmy/public/tasks/foo", "some text"
last_response.status.must_equal 403
end
it "disallows DELETE requests" do
delete "/jimmy/tasks/hello"
delete "/jimmy/public/tasks/hello"
last_response.status.must_equal 403
end