Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

interferes with following redirects #11

Open
dazza-codes opened this issue Aug 11, 2015 · 0 comments
Open

interferes with following redirects #11

dazza-codes opened this issue Aug 11, 2015 · 0 comments

Comments

@dazza-codes
Copy link

Given this code:

loc = "https://jigsaw.w3.org/HTTP/300/301.html"
r = RestClient.get(url){ |response, request, result, &block|
        if [301, 302, 307].include? response.code
          loc = response.headers[:location]
          response.follow_redirection(request, result, &block)
        else
          response.return!(request, result, &block)
        end
}

The result should be loc == 'https://jigsaw.w3.org/HTTP/300/Overview.html'. However, when rest-client-components are required, the redirect behavior fails because the response.code == 304 and there is no value in response.headers[:location].

How do we get the redirected URL when using rest-client 1.8.0 with rest-client-components?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant