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)

Sets the attribute partial_response

Parameters:

  • value

    the value to set the attribute partial_response to.



167
168
169
# File 'lib/httpx/plugins/retries.rb', line 167

def partial_response=(value)
  @partial_response = value
end

#retriesObject

Returns the value of attribute retries.



165
166
167
# File 'lib/httpx/plugins/retries.rb', line 165

def retries
  @retries
end

Instance Method Details

#initialize(*args) ⇒ Object



169
170
171
172
# File 'lib/httpx/plugins/retries.rb', line 169

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

#response=(response) ⇒ Object



174
175
176
177
178
179
180
181
182
183
184
185
# File 'lib/httpx/plugins/retries.rb', line 174

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