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.



196
197
198
# File 'lib/httpx/plugins/retries.rb', line 196

def partial_response=(value)
  @partial_response = value
end

#retriesObject

number of retries left.



193
194
195
# File 'lib/httpx/plugins/retries.rb', line 193

def retries
  @retries
end

Instance Method Details

#initialize(*args) ⇒ Object

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



199
200
201
202
# File 'lib/httpx/plugins/retries.rb', line 199

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

#response=(response) ⇒ Object



204
205
206
207
208
209
210
211
212
213
214
215
# File 'lib/httpx/plugins/retries.rb', line 204

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