From 94670037e8fdeddc882e4fb7fd8025f85784c48f Mon Sep 17 00:00:00 2001 From: Yufan Sheng Date: Fri, 11 Nov 2022 22:49:32 +0800 Subject: [PATCH] fix: correctly set the resty redirect policies. --- internal/client/client.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/client/client.go b/internal/client/client.go index 68a5a55..43f1215 100644 --- a/internal/client/client.go +++ b/internal/client/client.go @@ -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), } @@ -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).