The Browser.shouldRedirect() method prevents operations when FollowRedirects is false, which is needed in some case, like debugging a form-based workflow to ascertain the data during intermediary redirect.
This is normally supported by returning ErrUseLastResponse instead of a nondescript error like that function does.
This suggests two ways to address the problem
either just return the ErrUseLastResponse error, which is probably the most logical, but will likely break a number of uses
support injecting either the Client.CheckRedirect or even the complete client in the Browser object, to allow use of a custom redirect handler, as well as other changes. One nice way to do this in compatible fashion would be for NewBrowser to take a variadic Options providing the ability to customize the browser.
The
Browser.shouldRedirect()
method prevents operations whenFollowRedirects
isfalse
, which is needed in some case, like debugging a form-based workflow to ascertain the data during intermediary redirect.This is normally supported by returning
ErrUseLastResponse
instead of a nondescripterror
like that function does.This suggests two ways to address the problem
ErrUseLastResponse
error, which is probably the most logical, but will likely break a number of usesClient.CheckRedirect
or even the complete client in theBrowser
object, to allow use of a custom redirect handler, as well as other changes. One nice way to do this in compatible fashion would be forNewBrowser
to take a variadicOptions
providing the ability to customize the browser.