MCPcopy Create free account
hub / github.com/OpenListTeam/OpenList / InitClient

Function InitClient

drivers/base/client.go:24–35  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

22const UserAgentNT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Safari/537.36 Chrome/142.0.0.0 OpenList/425.6.30"
23
24func InitClient() {
25 NoRedirectClient = resty.New().SetRedirectPolicy(
26 resty.RedirectPolicyFunc(func(req *http.Request, via []*http.Request) error {
27 return http.ErrUseLastResponse
28 }),
29 ).SetTLSClientConfig(&tls.Config{InsecureSkipVerify: conf.Conf.TlsInsecureSkipVerify})
30 NoRedirectClient.SetHeader("user-agent", UserAgent)
31 net.SetRestyProxyIfConfigured(NoRedirectClient)
32
33 RestyClient = NewRestyClient()
34 HttpClient = net.NewHttpClient()
35}
36
37func NewRestyClient() *resty.Client {
38 client := resty.New().

Callers 1

InitConfigFunction · 0.92

Calls 4

NewHttpClientFunction · 0.92
NewRestyClientFunction · 0.85
SetHeaderMethod · 0.80

Tested by

no test coverage detected