MCPcopy Create free account
hub / github.com/LumaAI-API/Luma-API / InitTlsHTTPClient

Function InitTlsHTTPClient

request.go:19–45  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17}
18
19func InitTlsHTTPClient() {
20 jar := tls_client.NewCookieJar()
21 options := []tls_client.HttpClientOption{
22 tls_client.WithTimeoutSeconds(360),
23 tls_client.WithClientProfile(profiles.Chrome_120),
24 tls_client.WithNotFollowRedirects(),
25 tls_client.WithCookieJar(jar), // create cookieJar instance and pass it as argument
26 }
27 client, _ := tls_client.NewHttpClient(tls_client.NewNoopLogger(), options...)
28 TlsHTTPClient = client
29
30 HTTPClient = &http.Client{}
31 if common.Proxy != "" {
32 TlsHTTPClient.SetProxy(common.Proxy)
33
34 u, err := url.Parse(common.Proxy)
35 if err != nil {
36 common.Logger.Error("Invalid proxy URL: " + common.Proxy)
37 panic(err)
38 }
39 HTTPClient = &http.Client{
40 Transport: &http.Transport{
41 Proxy: http.ProxyURL(u),
42 },
43 }
44 }
45}
46
47func DoRequest(method, url string, body io.Reader, otherHeaders map[string]string) (*http.Response, error) {
48 headers := map[string]string{

Callers 1

initFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected