pcgamedb/utils/request.go
2024-12-10 21:37:16 +08:00

19 lines
380 B
Go

package utils
import (
"time"
"github.com/go-resty/resty/v2"
)
var client *resty.Client
func init() {
client = resty.New()
client.SetRetryCount(3).SetRetryWaitTime(1 * time.Second)
}
func Request() *resty.Request {
return client.R().SetHeader("Accept-Charset", "utf-8").SetHeader("User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:133.0) Gecko/20100101 Firefox/133.0")
}