class Seahorse::Client::Plugins::RequestCallback::ReadCallbackHandler

@api private

Public Instance Methods

add_event_listeners(context) click to toggle source
# File lib/seahorse/client/plugins/request_callback.rb, line 88
def add_event_listeners(context)
  # unwrap the request body as soon as we start receiving a response
  context.http_response.on_headers do
    body = context.http_request.body
    if body.is_a? ReadCallbackIO
      context.http_request.body = body.io
    end
  end
end
call(context) click to toggle source
# File lib/seahorse/client/plugins/request_callback.rb, line 77
def call(context)
  if (callback = context[:on_chunk_sent])
    context.http_request.body = ReadCallbackIO.new(
      context.http_request.body,
      callback
    )
    add_event_listeners(context)
  end
  @handler.call(context)
end