File tree Expand file tree Collapse file tree 2 files changed +16
-14
lines changed Expand file tree Collapse file tree 2 files changed +16
-14
lines changed Original file line number Diff line number Diff line change @@ -25,24 +25,20 @@ def initialize(body, callback)
25
25
end
26
26
27
27
def finish
28
- if @body
29
- result = super
30
-
31
- @callback . call
32
-
33
- @body = nil
34
-
35
- return result
28
+ super . tap do
29
+ if @callback
30
+ @callback . call
31
+ @callback = nil
32
+ end
36
33
end
37
34
end
38
35
39
36
def close ( error = nil )
40
- if @body
41
- super
42
-
43
- @callback . call ( error )
44
-
45
- @body = nil
37
+ super . tap do
38
+ if @callback
39
+ @callback . call ( error )
40
+ @callback = nil
41
+ end
46
42
end
47
43
end
48
44
end
Original file line number Diff line number Diff line change 5
5
6
6
require 'protocol/http/body/completable'
7
7
require 'protocol/http/body/buffered'
8
+ require 'protocol/http/request'
8
9
9
10
describe Protocol ::HTTP ::Body ::Completable do
10
11
let ( :body ) { Protocol ::HTTP ::Body ::Buffered . new }
76
77
completable . finish
77
78
end
78
79
end
80
+
81
+ it "doesn't break #read after finishing" do
82
+ completable . finish
83
+ expect ( completable . read ) . to be_nil
84
+ end
79
85
end
80
86
end
You can’t perform that action at this time.
0 commit comments