lib/httpx/request.rb in httpx-0.23.4 vs lib/httpx/request.rb in httpx-0.24.0
- old
+ new
@@ -93,10 +93,12 @@
if response.is_a?(Response) && response.status == 100 && @headers.key?("expect")
@informational_status = response.status
return
end
@response = response
+
+ emit(:response_started, response)
end
def path
path = uri.path.dup
path = +"" if path.nil?
@@ -128,11 +130,13 @@
def drain_body
return nil if @body.nil?
@drainer ||= @body.each
- chunk = @drainer.next
- chunk.dup
+ chunk = @drainer.next.dup
+
+ emit(:body_chunk, chunk)
+ chunk
rescue StopIteration
nil
rescue StandardError => e
@drain_error = e
nil