Skip to content

Commit a423d5e

Browse files
committed
Add on_interim_response.
1 parent 899c690 commit a423d5e

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

lib/protocol/http/request.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,17 @@ def send_interim_response(status, headers)
7474
@interim_response&.call(status, headers)
7575
end
7676

77+
def on_interim_response(&block)
78+
if interim_response = @interim_response
79+
@interim_response = ->(status, headers) do
80+
block.call(status, headers)
81+
interim_response.call(status, headers)
82+
end
83+
else
84+
@interim_response = block
85+
end
86+
end
87+
7788
# Whether this is a HEAD request: no body is expected in the response.
7889
def head?
7990
@method == Methods::HEAD

0 commit comments

Comments
 (0)