Module: HTTPX::Plugins::FollowRedirects::RequestMethods

Defined in:
lib/httpx/plugins/follow_redirects.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#root_requestObject

returns the top-most original HTTPX::Request from the redirect chain



192
193
194
# File 'lib/httpx/plugins/follow_redirects.rb', line 192

def root_request
  @root_request
end

Instance Method Details

#max_redirectsObject



212
213
214
# File 'lib/httpx/plugins/follow_redirects.rb', line 212

def max_redirects
  @options.max_redirects || MAX_REDIRECTS
end

#redirect_requestObject

returns the follow-up redirect request, or itself



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

def redirect_request
  @redirect_request || self
end

#redirect_request=(req) ⇒ Object

sets the follow-up redirect request



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

def redirect_request=(req)
  @redirect_request = req
  req.root_request = @root_request || self
  @response = nil
end

#responseObject



206
207
208
209
210
# File 'lib/httpx/plugins/follow_redirects.rb', line 206

def response
  return super unless @redirect_request && @response.nil?

  @redirect_request.response
end