lib/protocol/http/body/readable.rb in protocol-http-0.10.0 vs lib/protocol/http/body/readable.rb in protocol-http-0.11.0
- old
+ new
@@ -71,9 +71,11 @@
# Flushing after every chunk is inefficient, but it's also a safe default.
self.each do |chunk|
stream.write(chunk)
stream.flush
end
+ ensure
+ stream.close
end
# Read all remaining chunks into a single binary string using `#each`.
def join
buffer = String.new.force_encoding(Encoding::BINARY)