rest-client-components icon indicating copy to clipboard operation
rest-client-components copied to clipboard

interferes with following redirects

Open dazza-codes opened this issue 10 years ago • 0 comments

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?

dazza-codes avatar Aug 11 '15 22:08 dazza-codes