Fix a bug when a document has an empty body
Add check on content length for an empty file
This commit is contained in:
parent
247559e563
commit
a15635ce38
@ -68,7 +68,10 @@ module RemoteStorage
|
|||||||
when "application/json"
|
when "application/json"
|
||||||
return object.data.to_json
|
return object.data.to_json
|
||||||
else
|
else
|
||||||
return serializer_for(object.content_type) ? object.data : object.raw_data
|
data = serializer_for(object.content_type) ? object.data : object.raw_data
|
||||||
|
|
||||||
|
# Never return nil, always turn data into a string
|
||||||
|
return data.nil? ? '' : data
|
||||||
end
|
end
|
||||||
rescue ::Riak::HTTPFailedRequest
|
rescue ::Riak::HTTPFailedRequest
|
||||||
server.halt 404
|
server.halt 404
|
||||||
|
@ -76,6 +76,7 @@ describe "App with Riak backend" do
|
|||||||
it "returns an empty body" do
|
it "returns an empty body" do
|
||||||
last_response.status.must_equal 200
|
last_response.status.must_equal 200
|
||||||
last_response.body.must_equal ""
|
last_response.body.must_equal ""
|
||||||
|
last_response.headers["Content-Length"].must_equal '0'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user