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"
|
||||
return object.data.to_json
|
||||
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
|
||||
rescue ::Riak::HTTPFailedRequest
|
||||
server.halt 404
|
||||
|
@ -76,6 +76,7 @@ describe "App with Riak backend" do
|
||||
it "returns an empty body" do
|
||||
last_response.status.must_equal 200
|
||||
last_response.body.must_equal ""
|
||||
last_response.headers["Content-Length"].must_equal '0'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user