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.



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

def partial_response=(value)
  @partial_response = value
end

#retriesObject

number of retries left.



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

def retries
  @retries
end

Instance Method Details

#initialize(*args) ⇒ Object

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



201
202
203
204
# File 'lib/httpx/plugins/retries.rb', line 201

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

#response=(response) ⇒ Object



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

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