mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Redirect a maximum of 5 times instead of time limit, closes #67
This is as per http://www.ietf.org/rfc/rfc2068.txt "A user agent SHOULD NOT automatically redirect a request more than 5 times, since such redirections usually indicate an infinite loop."
This commit is contained in:
parent
d72d9998ff
commit
2e6745e676
1 changed files with 2 additions and 4 deletions
|
@ -249,10 +249,8 @@ private
|
|||
end
|
||||
|
||||
def follow_redirects!
|
||||
Capybara::WaitUntil.timeout(4) do
|
||||
redirect = response.redirect?
|
||||
follow_redirect! if redirect
|
||||
not redirect
|
||||
5.times do
|
||||
follow_redirect! if response.redirect?
|
||||
end
|
||||
rescue Capybara::TimeoutError
|
||||
raise Capybara::InfiniteRedirectError, "infinite redirect detected!"
|
||||
|
|
Loading…
Add table
Reference in a new issue