lib/protocol/http/body/readable.rb in protocol-http-0.14.4 vs lib/protocol/http/body/readable.rb in protocol-http-0.15.0
- old
+ new
@@ -61,11 +61,10 @@
# Enumerate all chunks until finished, then invoke `#close`.
def each
while chunk = self.read
yield chunk
- # chunk.clear
end
ensure
self.close($!)
end
@@ -76,10 +75,14 @@
self.each do |chunk|
buffer << chunk
chunk.clear
end
- return buffer
+ if buffer.empty?
+ return nil
+ else
+ return buffer
+ end
end
end
end
end
end