-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Passing the http.DefaultClient to a New client can lead to breakdowns #3028
Comments
You are saying that the actual |
@gmlewis yes, exactly. That's the scenario I've encountered. After instantiating a new github client ( Changing the That made me infer that the Note: #1173 can be related. |
The operations executed with the github client where (at least) the
|
Oh, and the client is instantiated with:
Which could be also a point where the issue is happening. Hope it helps. |
Just saw https://github.com/google/go-github/blob/master/github/github.go#L318
Since both the Probably making a value-clone, kind of:
would solve the issue (but we would be also missing the point of using a pointer injection on Other option without breaking changes would be having a |
So first off, to immediately get to the bottom of this, please run your program again under delve the Go debugger, set a watch on Once you have clearly identified the file and line number in this repo that is modifying |
I'm hoping this will be fixed by #3011. |
Sorry for the waiting. Here's the snippet:
´http.DefaultClient.Transport´ pass from |
! Not sure if I'm getting into a bad practice of this should be an expected behaviour
Instantiating a client with the Default http Golang client (
client := github.NewClient(http.DefaultClient)
leads to the perversion of the http.DefaultClient content, which when used over the rest of the code, starts breaking when for example using a Bearer token as Authorization: It will return 201, appearing the header not being included in the response.If after making any Github calls with a
client := github.NewClient(http.DefaultClient)
, we run this codeThe
http.DefaultClient
will seem perverted since it will appear the Authorization header is not being correctly sent, as the retrieved StatusCode will be 201.Extrainfo: Using
go 1.21.4
The text was updated successfully, but these errors were encountered: