Module: HTTPX::Plugins::Callbacks::RequestMethods

Defined in:
lib/httpx/plugins/callbacks.rb,
sig/plugins/callbacks.rbs

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#connection ⇒ callbackConnection? (readonly)

allows getting the connection that the request was sent over

Returns:

  • (callbackConnection, nil)


132
133
134
# File 'lib/httpx/plugins/callbacks.rb', line 132

def connection
  @connection
end

#last_connection ⇒ callbackConnection?

gets the failed connection the request was supposed to be sent over

Returns:

  • (callbackConnection, nil)


135
136
137
# File 'lib/httpx/plugins/callbacks.rb', line 135

def last_connection
  @last_connection
end

Instance Method Details

#drain_body ⇒ Object



137
138
139
140
141
142
143
144
145
# File 'lib/httpx/plugins/callbacks.rb', line 137

def drain_body
  super.tap do |chunk|
    emit(:body_chunk, chunk) if chunk
  rescue StandardError => e
    # in case an error occurs in callback code
    @drain_error = e
    nil
  end
end