File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -550,7 +550,21 @@ func (r *request) do(ctx context.Context) (*http.Response, error) {
550550 if err := r .authorize (ctx , req ); err != nil {
551551 return nil , errors .Wrap (err , "failed to authorize" )
552552 }
553- resp , err := ctxhttp .Do (ctx , r .host .Client , req )
553+
554+ var client = & http.Client {}
555+ if r .host .Client != nil {
556+ * client = * r .host .Client
557+ }
558+ if client .CheckRedirect == nil {
559+ client .CheckRedirect = func (req * http.Request , via []* http.Request ) error {
560+ if len (via ) >= 10 {
561+ return errors .New ("stopped after 10 redirects" )
562+ }
563+ return errors .Wrap (r .authorize (ctx , req ), "failed to authorize redirect" )
564+ }
565+ }
566+
567+ resp , err := ctxhttp .Do (ctx , client , req )
554568 if err != nil {
555569 return nil , errors .Wrap (err , "failed to do request" )
556570 }
You can’t perform that action at this time.
0 commit comments