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.



241
242
243
# File 'lib/httpx/plugins/retries.rb', line 241

def partial_response=(value)
  @partial_response = value
end

#retriesObject

number of retries left.



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

def retries
  @retries
end

Instance Method Details

#initialize(*args) ⇒ Object

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



244
245
246
247
248
# File 'lib/httpx/plugins/retries.rb', line 244

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

#response=(response) ⇒ Object



250
251
252
253
254
255
256
257
258
259
260
261
# File 'lib/httpx/plugins/retries.rb', line 250

def response=(response)
  if (partial_response = @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