Module: HTTPX::Plugins::Retries::RequestMethods

Defined in:
lib/httpx/plugins/retries.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#partial_response=(value) ⇒ Object (writeonly)

a response partially received before.



234
235
236
# File 'lib/httpx/plugins/retries.rb', line 234

def partial_response=(value)
  @partial_response = value
end

#retriesObject

number of retries left.



231
232
233
# File 'lib/httpx/plugins/retries.rb', line 231

def retries
  @retries
end

Instance Method Details

#initialize(*args) ⇒ Object

initializes the request instance, sets the number of retries for the request.



237
238
239
240
# File 'lib/httpx/plugins/retries.rb', line 237

def initialize(*args)
  super
  @retries = @options.max_retries
end

#response=(response) ⇒ Object



242
243
244
245
246
247
248
249
250
251
252
253
# File 'lib/httpx/plugins/retries.rb', line 242

def response=(response)
  if @partial_response
    if response.is_a?(Response) && response.status == 206
      response.from_partial_response(@partial_response)
    else
      @partial_response.close
    end
    @partial_response = nil
  end

  super
end