class Typhoeus::EasyFactory
def set_callback
Experimental RBS support (using type sampling data from the type_fusion
project).
def set_callback: () -> Array[Proc]
This signature was generated using 31 samples from 1 application.
-
(Ethon::Easy)
- The easy.
Other tags:
- Example: Set callback. -
def set_callback if request.streaming? response = nil easy.on_headers do |easy| response = Response.new(Ethon::Easy::Mirror.from_easy(easy).options) request.execute_headers_callbacks(response) end request.on_body.each do |callback| easy.on_body do |chunk, easy| callback.call(chunk, response) end end else easy.on_headers do |easy| request.execute_headers_callbacks(Response.new(Ethon::Easy::Mirror.from_easy(easy).options)) end end request.on_progress.each do |callback| easy.on_progress do |dltotal, dlnow, ultotal, ulnow, easy| callback.call(dltotal, dlnow, ultotal, ulnow, response) end end easy.on_complete do |easy| request.finish(Response.new(easy.mirror.options)) Typhoeus::Pool.release(easy) if hydra && !hydra.queued_requests.empty? hydra.dequeue_many end end end