Class: Seahorse::Client::Plugins::RequestCallback::ReadCallbackHandler Private

Inherits:
Handler
  • Object
show all
Defined in:
lib/seahorse/client/plugins/request_callback.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary

Attributes inherited from Handler

#handler

Instance Method Summary collapse

Methods inherited from Handler

#initialize, #inspect

Constructor Details

This class inherits a constructor from Seahorse::Client::Handler

Instance Method Details

#call(context) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/seahorse/client/plugins/request_callback.rb', line 108

def call(context)
  if (callback = context[:on_chunk_sent])
    context.http_request.body = ReadCallbackIO.new(
      context.http_request.body,
      callback
    )
    @handler.call(context).tap do
      unwrap_callback_body(context)
    end
  else
    @handler.call(context)
  end
end

#unwrap_callback_body(context) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



122
123
124
125
126
127
# File 'lib/seahorse/client/plugins/request_callback.rb', line 122

def unwrap_callback_body(context)
  body = context.http_request.body
  if body.is_a? ReadCallbackIO
    context.http_request.body = body.io
  end
end