File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change 1313# Custom error class to track in tests
1414class BodyWriteError < StandardError ; end
1515
16- # A custom body class that raises during enumeration .
16+ # A custom body class that raises during reading .
1717class ErrorProneBody < ::Protocol ::HTTP ::Body ::Readable
1818 def initialize ( ...)
1919 super ( ...)
2020
2121 @error = nil
22+ @count = 0
2223 end
2324
2425 attr :error
2526
27+ def read
28+ @count += 1
29+ raise BodyWriteError , "error during write" if @count > 1
30+
31+ "Hello"
32+ end
33+
2634 def close ( error = nil )
2735 @error = error
2836 super ( )
2937 end
30-
31- def each
32- super
33- raise BodyWriteError , "error during write"
34- end
3538end
3639
3740describe Async ::HTTP ::Protocol ::HTTP11 do
@@ -70,7 +73,6 @@ def each
7073
7174 let ( :app ) do
7275 Protocol ::HTTP ::Middleware . for do |request |
73- # Return a response with a body that will raise during enumeration:
7476 Protocol ::HTTP ::Response [ 200 , { } , body ]
7577 end
7678 end
You can’t perform that action at this time.
0 commit comments