Skip to content

Commit

Permalink
fix: nil ref error
Browse files Browse the repository at this point in the history
  • Loading branch information
bubbajoe committed May 12, 2024
1 parent 2fbe229 commit 38f3df2
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/dgclient/dgclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,12 @@ func WithBasicAuth(username, password string) Options {
func WithFollowRedirect(follow bool) Options {
return func(dc DGateClient) {
if d, ok := dc.(*dgateClient); ok {
d.client.CheckRedirect = func(req *http.Request, via []*http.Request) error {
if follow {
return nil
if follow {
d.client.CheckRedirect = nil
} else {
d.client.CheckRedirect = func(req *http.Request, via []*http.Request) error {
return http.ErrUseLastResponse
}
return http.ErrUseLastResponse
}
}
}
Expand Down

0 comments on commit 38f3df2

Please sign in to comment.