Fix handling of keys containing colons (fixes #13)
This commit is contained in:
@@ -18,7 +18,7 @@ describe "Directories" do
|
||||
|
||||
before do
|
||||
put "/jimmy/tasks/foo", "do the laundry"
|
||||
put "/jimmy/tasks/bar", "do the laundry"
|
||||
put "/jimmy/tasks/http%3A%2F%2F5apps.com", "prettify design"
|
||||
end
|
||||
|
||||
it "lists the objects with a timestamp of the last modification" do
|
||||
@@ -28,7 +28,7 @@ describe "Directories" do
|
||||
last_response.content_type.must_equal "application/json"
|
||||
|
||||
content = JSON.parse(last_response.body)
|
||||
content.must_include "bar"
|
||||
content.must_include "http://5apps.com"
|
||||
content.must_include "foo"
|
||||
content["foo"].to_s.must_match /\d+/
|
||||
content["foo"].to_s.length.must_be :>=, 10
|
||||
@@ -62,7 +62,7 @@ describe "Directories" do
|
||||
|
||||
content = JSON.parse(last_response.body)
|
||||
content.must_include "foo"
|
||||
content.must_include "bar"
|
||||
content.must_include "http://5apps.com"
|
||||
content.must_include "home/"
|
||||
content["home/"].to_s.must_match /\d+/
|
||||
content["home/"].to_s.length.must_be :>=, 10
|
||||
|
||||
@@ -174,6 +174,19 @@ describe "App with Riak backend" do
|
||||
end
|
||||
end
|
||||
|
||||
context "with escaped key" do
|
||||
before do
|
||||
put "/jimmy/documents/http%3A%2F%2F5apps.com", "super website"
|
||||
end
|
||||
|
||||
it "delivers the data correctly" do
|
||||
header "Authorization", "Bearer 123"
|
||||
get "/jimmy/documents/http%3A%2F%2F5apps.com"
|
||||
|
||||
last_response.body.must_equal 'super website'
|
||||
end
|
||||
end
|
||||
|
||||
context "invalid JSON" do
|
||||
context "empty body" do
|
||||
before do
|
||||
|
||||
Reference in New Issue
Block a user