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)
2525 end
2626
2727 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
3633 end
3734 end
3835
3936 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
4642 end
4743 end
4844 end
Original file line number Diff line number Diff line change 55
66require 'protocol/http/body/completable'
77require 'protocol/http/body/buffered'
8+ require 'protocol/http/request'
89
910describe Protocol ::HTTP ::Body ::Completable do
1011 let ( :body ) { Protocol ::HTTP ::Body ::Buffered . new }
7677 completable . finish
7778 end
7879 end
80+
81+ it "doesn't break #read after finishing" do
82+ completable . finish
83+ expect ( completable . read ) . to be_nil
84+ end
7985 end
8086end
You can’t perform that action at this time.
0 commit comments