Fixed HTTPClient
in retryablehttp.Client
not taking over in newRetryableHTTPClientWithRetryCheck
-
Please check this box if this contribution uses AI-generated content (including content generated by GitLab Duo features) as outlined in the GitLab DCO & CLA. As a benefit of being a GitLab Community Contributor, you receive complimentary access to GitLab Duo.
This is a small bug in !2201 (merged)
For normal use cases, there was no problem.
However, there was a bug that when using gitlab.WithHTTPClient
and gitlab.WithRequestRetry
at the same time, the HTTPClient
passed in with gitlab.WithHTTPClient
was not used
e.g.
myHTTPClient := &http.Client{}
git := gitlab.NewClient("MY_PRIVATE_TOKEN", gitlab.WithHTTPClient(myHTTPClient))
// myHTTPClient is not used here...
_, _, err := git.MergeRequests.AcceptMergeRequest(
"user/my-repo", mrIID,
&gitlab.AcceptMergeRequestOptions{MergeWhenPipelineSucceeds: gitlab.Ptr(true)},
gitlab.WithRequestRetry(retryHTTPCheckForAcceptMergeRequest),
)
In fact, when mocking API communication using https://github.com/jarcoal/httpmock, there was a phenomenon that it did not work properly.
Edited by sue445