Merge pull request #85 from Zangwill/patch-5

修复 Get "https://webpus.../synccheck?... 退出问题
This commit is contained in:
聂青 2021-09-16 17:47:21 +08:00 committed by GitHub
commit c2641bd6ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -54,11 +54,13 @@ func NewClient(client *http.Client) *Client {
// 设置客户端不自动跳转
func DefaultClient() *Client {
jar, _ := cookiejar.New(nil)
timeout := time.Duration(30 * time.Second)
client := &http.Client{
CheckRedirect: func(req *http.Request, via []*http.Request) error {
return http.ErrUseLastResponse
},
Jar: jar,
Timeout: timeout,
}
c := NewClient(client)
c.AddHttpHook(UserAgentHook{})