Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SetProxyURL 后是否可以自主清除Proxy #379

Open
WyntersN opened this issue Aug 11, 2024 · 0 comments
Open

SetProxyURL 后是否可以自主清除Proxy #379

WyntersN opened this issue Aug 11, 2024 · 0 comments

Comments

@WyntersN
Copy link

WyntersN commented Aug 11, 2024

var repsClient = req.C().
	SetBaseURL("https://sc.scm121.com/api").SetCommonContentType("application/json; charset=utf-8").
	SetUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.6261.95 Safari/537.36").
	SetTimeout(1 * time.Minute).EnableDumpAllToFile("./runtime/dumpReq.txt")


func (c Content) RequestGet(url string, urlParams map[string]string) (JSON, error) {
	var (
		result        reqsResult
		repsClientNew = repsClient
	)
	if c.Proxy != "" {
		repsClientNew = repsClientNew.SetProxyURL(c.Proxy)
	}
	res, _ := repsClientNew.R().SetQueryParams(urlParams).SetSuccessResult(&result).Get(url)
	return JSON(nil), res.Err
}

我写了一个通用的Request Get
只要被代理访问了,有些地方不需要代理访问也会经过代理,
我repsClientNew 设置的代理 repsClient没有从没设置过代理 ,
repsClientNew 代理怎么 会跑给 repsClient 导致所有 repsClient 都设置了这个代理。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant