MCPcopy Index your code
hub / github.com/SpectoLabs/hoverfly / GetDefaultHoverflyHTTPClient

Function GetDefaultHoverflyHTTPClient

core/http.go:17–42  ·  view source on GitHub ↗
(tlsVerification bool, upstreamProxy string)

Source from the content-addressed store, hash-verified

15)
16
17func GetDefaultHoverflyHTTPClient(tlsVerification bool, upstreamProxy string) *http.Client {
18
19 var proxyURL func(*http.Request) (*url.URL, error)
20 if upstreamProxy == "" {
21 proxyURL = http.ProxyURL(nil)
22 } else {
23 if upstreamProxy[0:4] != "http" {
24 upstreamProxy = "http://" + upstreamProxy
25 }
26 u, err := url.Parse(upstreamProxy)
27 if err != nil {
28 log.Fatalf("Could not parse upstream proxy: %s", err.Error())
29 }
30 proxyURL = http.ProxyURL(u)
31 }
32
33 return &http.Client{CheckRedirect: func(req *http.Request, via []*http.Request) error {
34 return http.ErrUseLastResponse
35 }, Transport: &http.Transport{
36 Proxy: proxyURL,
37 TLSClientConfig: &tls.Config{
38 InsecureSkipVerify: !tlsVerification,
39 Renegotiation: tls.RenegotiateFreelyAsClient,
40 },
41 }}
42}
43
44func GetHttpClient(hf *Hoverfly, host string) (*http.Client, error) {
45 if hf.Cfg.PACFile != nil {

Callers 5

parsePACFileResultFunction · 0.85
NewHoverflyFunction · 0.85
GetNewHoverflyFunction · 0.85

Calls 1

ErrorMethod · 0.45

Tested by 1