rest-client-components
rest-client-components copied to clipboard
interferes with following redirects
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?