MCPcopy Index your code
hub / github.com/imroc/req / SetProxyURL

Method SetProxyURL

client.go:1052–1065  ·  view source on GitHub ↗

SetProxyURL set proxy from the proxy URL.

(proxyUrl string)

Source from the content-addressed store, hash-verified

1050
1051// SetProxyURL set proxy from the proxy URL.
1052func (c *Client) SetProxyURL(proxyUrl string) *Client {
1053 if proxyUrl == "" {
1054 c.log.Warnf("ignore empty proxy url in SetProxyURL")
1055 return c
1056 }
1057 u, err := urlpkg.Parse(proxyUrl)
1058 if err != nil {
1059 c.log.Errorf("failed to parse proxy url %s: %v", proxyUrl, err)
1060 return c
1061 }
1062 proxy := http.ProxyURL(u)
1063 c.SetProxy(proxy)
1064 return c
1065}
1066
1067// DisableTraceAll disable trace for requests fired from the client.
1068func (c *Client) DisableTraceAll() *Client {

Callers 4

TestLoggerFunction · 0.80
TestSetProxyURLFunction · 0.80
SetProxyURLFunction · 0.80

Calls 4

SetProxyMethod · 0.95
ParseMethod · 0.80
WarnfMethod · 0.65
ErrorfMethod · 0.65

Tested by 3

TestLoggerFunction · 0.64
TestSetProxyURLFunction · 0.64