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.



77
78
79
80
81
82
83
84
85
86
87
88
89
# 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
    )
    @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.



91
92
93
94
95
96
# File 'lib/seahorse/client/plugins/request_callback.rb', line 91

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