Module: RestClient::AbstractResponse
- Defined in:
- lib/gooddata/rest/connection.rb
Instance Method Summary collapse
- #follow_redirection(request = nil, result = nil, &block) ⇒ Object
-
#get_redirection_cookies(request, _result, _args) ⇒ Hash
Returns cookies which should be passed when following redirect.
- #old_follow_redirection ⇒ Object
Instance Method Details
#follow_redirection(request = nil, result = nil, &block) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/gooddata/rest/connection.rb', line 21 def follow_redirection(request = nil, result = nil, &block) fail 'Using monkey patched version of RestClient::AbstractResponse#follow_redirection which is guaranteed to be compatible only with RestClient 1.8.0' if RestClient::VERSION != '1.8.0' new_args = @args.dup url = headers[:location] url = URI.parse(request.url).merge(url).to_s if url !~ /^http/ new_args[:url] = url if request fail MaxRedirectsReached if request.max_redirects.zero? new_args[:password] = request.password new_args[:user] = request.user new_args[:headers] = request.headers new_args[:max_redirects] = request.max_redirects - 1 # TODO: figure out what to do with original :cookie, :cookies values new_args[:cookies] = (request, result, new_args) end Request.execute(new_args, &block) end |
#get_redirection_cookies(request, _result, _args) ⇒ Hash
Returns cookies which should be passed when following redirect
50 51 52 |
# File 'lib/gooddata/rest/connection.rb', line 50 def (request, _result, _args) request. end |
#old_follow_redirection ⇒ Object
20 |
# File 'lib/gooddata/rest/connection.rb', line 20 alias_method :old_follow_redirection, :follow_redirection |