We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1ed69f0 commit 479d0bfCopy full SHA for 479d0bf
1 file changed
lib/protocol/http/body/stream.rb
@@ -52,9 +52,11 @@ module Reader
52
# @parameter buffer [String] the buffer which will receive the data
53
# @returns [String] a buffer containing the data
54
def read(length = nil, buffer = nil)
55
- return (buffer ? buffer.clear : String.new) if length == 0
+ if length == 0
56
+ return (buffer ? buffer.clear : String.new(encoding: Encoding::BINARY))
57
+ end
58
- buffer ||= String.new.force_encoding(Encoding::BINARY)
59
+ buffer ||= String.new(encoding: Encoding::BINARY)
60
61
# Take any previously buffered data and replace it into the given buffer.
62
if @buffer
0 commit comments