Closed benubois closed 2 years ago
Hello,
This adds an on_redirect callback that can be passed to .follow. For example:
on_redirect
.follow
permanent_redirects = [] HTTP.follow( max_hops: 4, on_redirect: proc do |from, to| permanent_redirects.push({ from: from.uri.to_s, to: to.uri.to_s }) if [301, 308].include?(from.status.code) end ).get("…")
I found this feature to be useful while trying to come up with a redirect caching system.
Thanks!
Hello,
This adds an
on_redirect
callback that can be passed to.follow
. For example:I found this feature to be useful while trying to come up with a redirect caching system.
Thanks!