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.



185
186
187
# File 'lib/httpx/plugins/retries.rb', line 185

def partial_response=(value)
  @partial_response = value
end

#retriesObject

Returns the value of attribute retries.



183
184
185
# File 'lib/httpx/plugins/retries.rb', line 183

def retries
  @retries
end

Instance Method Details

#initialize(*args) ⇒ Object



187
188
189
190
# File 'lib/httpx/plugins/retries.rb', line 187

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

#response=(response) ⇒ Object



192
193
194
195
196
197
198
199
200
201
202
203
# File 'lib/httpx/plugins/retries.rb', line 192

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