Closed DannyBen closed 6 years ago
The redirect handling is part of QtWebKit, which we rely on for most network processing.
We do a little processing to track redirects, but we only look at the Location
header as far as I can tell. This is likely a feature that isn't supported by the version of QtWebKit you're using. Unfortunately, it may not be supported by any version of QtWebKit, because QtWebKit development was largely abandoned years ago.
I see... is there a workaround for us peasants who still use it?... :)
Perhaps I should catch 308 after calls to visit
and follow redirect myself? Would that be feasible?
Yes, you could look at driver.status
and driver.response_headers
to verify that the page did what you expected.
Done. This seems to work.
When(/^I (?:go to|visit) "([^"]*)"$/) do |path|
visit path
if page.status_code == 308 and page.response_headers['Location']
visit page.response_headers['Location']
end
end
Thanks.
@DannyBen Quick question about this. What version of Qt did you build capybara-webkit with? because my tests show that this should work with Qt 5.5
Actually I take that back -- works for 307 not for 308
Actually I take that back -- works for 307 not for 308
You gave me hope.... then took it away... :) Thanks for checking.
@DannyBen Sorry about that -- 308 wasn't added to the HTTP spec until 2015 so no release version of QtWebkit supports it.
Not sure if this is a capybara-webkit issue or a capybara issue, or someone elses...
It seems like capybara does not follow 308 redirects.
Related code snippets:
Failing with: