Skip to content

Commit

Permalink
fix: correctly set the resty redirect policies.
Browse files Browse the repository at this point in the history
  • Loading branch information
syhily committed Nov 15, 2022
1 parent 6d7677b commit 9467003
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ func (c *Config) newCookieJar() (http.CookieJar, error) {
return newCookieJar(filepath.Join(configPath, cookieFile))
}

func (c *Config) redirectPolicy() []resty.RedirectPolicy {
policies := []resty.RedirectPolicy{
func (c *Config) redirectPolicy() []any {
policies := []any{
resty.FlexibleRedirectPolicy(5),
resty.DomainCheckRedirectPolicy(c.Host),
}
Expand Down Expand Up @@ -143,7 +143,7 @@ func New(c *Config) (*Client, error) {
SetRetryCount(3).
SetRetryWaitTime(3*time.Second).
SetRetryMaxWaitTime(10*time.Second).
SetRedirectPolicy(c.redirectPolicy()).
SetRedirectPolicy(c.redirectPolicy()...).
SetAllowGetMethodPayload(true).
SetTimeout(1*time.Minute).
SetContentLength(true).
Expand Down

0 comments on commit 9467003

Please sign in to comment.