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

[issue] it's better determine client is nil or not before assign it #125

Open
beaquant opened this issue Jan 16, 2019 · 2 comments
Open
Labels

Comments

@beaquant
Copy link

r.clientOnce.Do(func() {

We use NewWithClient give the client what we want, but when submit it will be reassigned it... could you determine client is nil or not before reassigned it?

@casualjim
Copy link
Member

Like here?

runtime/client/runtime.go

Lines 386 to 389 in 41e24cc

client := operation.Client
if client == nil {
client = r.client
}

@beaquant
Copy link
Author

beaquant commented Jan 17, 2019

yes, I think.
we use NewWithClient to assign client, so it's better change it like this

          r.clientOnce.Do(func() {
            if r.client == nil {
		r.client = &http.Client{
			Transport: r.Transport,
			Jar:       r.Jar,
		}
              }
	})

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

No branches or pull requests

3 participants