Don't try to deserialize an object to check if it already exists (fixes #29)
This commit is contained in:
parent
1a2933bf48
commit
629ff399ff
@ -90,7 +90,7 @@ module RemoteStorage
|
|||||||
def put_data(user, directory, key, data, content_type=nil)
|
def put_data(user, directory, key, data, content_type=nil)
|
||||||
object = build_data_object(user, directory, key, data, content_type)
|
object = build_data_object(user, directory, key, data, content_type)
|
||||||
|
|
||||||
object_exists = !object.data.nil?
|
object_exists = !object.raw_data.nil?
|
||||||
existing_object_size = object_size(object)
|
existing_object_size = object_size(object)
|
||||||
|
|
||||||
timestamp = (Time.now.to_f * 1000).to_i
|
timestamp = (Time.now.to_f * 1000).to_i
|
||||||
|
|||||||
@ -219,6 +219,23 @@ describe "App with Riak backend" do
|
|||||||
update_entry.data["category"].must_equal "documents"
|
update_entry.data["category"].must_equal "documents"
|
||||||
update_entry.indexes["user_id_bin"].must_include "jimmy"
|
update_entry.indexes["user_id_bin"].must_include "jimmy"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "when no serializer is registered for the given content-type" do
|
||||||
|
before do
|
||||||
|
header "Content-Type", "text/html; charset=UTF-8"
|
||||||
|
put "/jimmy/documents/html", '<html></html>'
|
||||||
|
put "/jimmy/documents/html", '<html><body></body></html>'
|
||||||
|
end
|
||||||
|
|
||||||
|
it "saves the value" do
|
||||||
|
last_response.status.must_equal 200
|
||||||
|
data_bucket.get("jimmy:documents:html").raw_data.must_equal "<html><body></body></html>"
|
||||||
|
end
|
||||||
|
|
||||||
|
it "uses the requested content type" do
|
||||||
|
data_bucket.get("jimmy:documents:html").content_type.must_equal "text/html; charset=UTF-8"
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "public data" do
|
describe "public data" do
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user