Skip to content

Commit 2f46314

Browse files
committed
Correct handling of closed.
1 parent a9205c1 commit 2f46314

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

lib/protocol/rack/input.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,10 @@ def rewind
6464
if @body and @body.respond_to?(:rewind)
6565
# If the body is not rewindable, this will fail.
6666
@body.rewind
67+
6768
@buffer = nil
6869
@finished = false
70+
@closed = false
6971

7072
return true
7173
end

test/protocol/rack/input.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,11 @@
5454

5555
it "can rewind after reading all input" do
5656
expect(input.read).to be == sample_data.join
57+
expect(input).to be(:closed?)
58+
5759
input.rewind
5860

61+
expect(input).not.to be(:closed?)
5962
expect(input.read).to be == sample_data.join
6063
end
6164

@@ -78,8 +81,11 @@
7881

7982
it "can rewind after reading partial input" do
8083
expect(input.read(3)).to be == "The"
84+
expect(input).not.to be(:closed?)
85+
8186
input.rewind
8287

88+
expect(input).not.to be(:closed?)
8389
expect(input.read(3)).to be == "The"
8490
end
8591

0 commit comments

Comments
 (0)