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 whenFollowRedirectsisfalse, 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
ErrUseLastResponseinstead of a nondescripterrorlike that function does.This suggests two ways to address the problem
ErrUseLastResponseerror, which is probably the most logical, but will likely break a number of usesClient.CheckRedirector even the complete client in theBrowserobject, to allow use of a custom redirect handler, as well as other changes. One nice way to do this in compatible fashion would be forNewBrowserto take a variadicOptionsproviding the ability to customize the browser.