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.
#readpartial
1 parent 1392355 commit 4461f75Copy full SHA for 4461f75
2 files changed
lib/protocol/http/body/stream.rb
@@ -98,8 +98,8 @@ def read_partial(length = nil)
98
return buffer
99
end
100
101
- def readpartial
102
- read_partial or raise EOFError, "End of file reached!"
+ def readpartial(length)
+ read_partial(length) or raise EOFError, "End of file reached!"
103
104
105
def read_nonblock(length, buffer = nil)
test/protocol/http/body/stream.rb
@@ -123,6 +123,14 @@
123
124
125
126
+ with '#readpartial' do
127
+ it "can read partial input" do
128
+ expect(stream.readpartial(20)).to be == "Hello"
129
+ expect(stream.readpartial(20)).to be == "World"
130
+ expect{stream.readpartial(20)}.to raise_exception(EOFError)
131
+ end
132
133
+
134
with '#close_read' do
135
it "should close the input" do
136
stream.read(1)
0 commit comments